C     OVERLAY(MISSION,0,0)                                              MAIN
      PROGRAM NSEGII ( INPUT=257, OUTPUT=513, TAPE5=INPUT, TAPE6=OUTPUT,MAIN
     1                 TAPE25=257, TAPE15=513, TAPE20=513)              MAIN
C      ELIMINATE STUFF ASSOCIATED WITH PLOTS AT LRC                     MAIN
C                  NOTE - -  IN THE FUTURE THIS MAY BE EXPANDED BY A    MAIN
C                  CALL TO PSEUDO AND THE APPROPRIATE LRC PLOTTING      MAIN
C                  ROUTINES EITHER DIRECTLY OR THROUGH INTERFCAES.      MAIN
      COMMON /XQTMIS/ MISXQT                                            MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
C     COMMON /COMTAB/ TAB(6000)                                         MAIN
      COMMON /COMTAB/ TAB(3000)                                         MAIN
      COMMON /DICNAM/ LCOUNT, NAME(504), LOC(504)                       MAIN
      COMMON /TABNAM/ MAXT, TNAMES(126), LOCS(126), IS(126)             MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      LOGICAL LOAD                                                      MAIN
C     REAL D(1024)                                                      MAIN
      DATA LOAD /.FALSE./                                               MAIN
C     CALL PLOTS(D, 1024, 39)                                           MAIN
      IF(LOAD)  CALL PAGHED                                             MAIN
C     ...                                                               MAIN
C     DATA INITIALIZATION                                               MAIN
C     CALL OVERLAY(7LMISSION,1,0)                                       MAIN
      CALL INISEG                                                       MAIN
      REWIND 15                                                         MAIN
      CALL NDATA1                                                       MAIN
      CALL NDATA2                                                       MAIN
      CALL NDATA4                                                       MAIN
C     CALL NDATA9                                                       MAIN
  100 CONTINUE                                                          MAIN
C     ...                                                               MAIN
C     READ INPUT DATA                                                   MAIN
C     CALL OVERLAY(7LMISSION,2,0)                                       MAIN
      CALL INSEG                                                        MAIN
C     ...                                                               MAIN
C     ...                                                               MAIN
C     MISSION CALCULATION                                               MAIN
C     CALL OVERLAY(7LMISSION,3,0)                                       MAIN
      CALL MISION                                                       MAIN
C     ...                                                               MAIN
      GO TO 100                                                         MAIN
C                                                                       MAIN
C     REQUIRED TO MAKE SCOPE 3.4 WORK                                   MAIN
C                                                                       MAIN
      READ(15)DUM                                                       MAIN
      END                                                               MAIN
C     PROGRAM INISEG                                                    MAIN
      SUBROUTINE INISEG                                                 MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /COMTAB/ TAB(3000)                                         MAIN
      COMMON /TO LAND/ TAX(12), TAY1(12), TAY2(12),                     MAIN
     1                 TBX(27), TBY1(27), TBY2(27),                     MAIN
     2                 TCX(16), TCY1(16)                                MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(490),DATEE)                                    MAIN
      DO 10 I=1,775                                                     MAIN
      XNSEG(I) = 0.0                                                    MAIN
      TAB(I) =-0.0                                                      MAIN
   10 CONTINUE                                                          MAIN
      DO 20 I=776,3000                                                  MAIN
      TAB(I) =-0.0                                                      MAIN
   20 CONTINUE                                                          MAIN
      NUMSEG = 1                                                        MAIN
      DATEE=DATE(A)                                                     MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM INSEG                                                     MAIN
      SUBROUTINE INSEG                                                  MAIN
      COMMON /TABNAM/ MAXT, TNAMES(126), LOCS(126), IS(126)             MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /XQTMIS/ MISXQT                                            MAIN
      EQUIVALENCE (XNSEG(  3), XMSEG )                                  MAIN
      EQUIVALENCE (XNSEG(  4), TITLE )                                  MAIN
      EQUIVALENCE (XNSEG(267), IPDICN)                                  MAIN
      EQUIVALENCE (XNSEG(491), NPAGE )                                  MAIN
      EQUIVALENCE(XNSEG(538),LONG )                                     MAIN
      COMMON /COMTAB/ TAB(3000)                                         MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (CARD  , RDATA(  1))                                  MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (INC   , RDATA( 82))                                  MAIN
      EQUIVALENCE (OP    , RDATA( 83))                                  MAIN
      EQUIVALENCE (FLAG  , RDATA( 84))                                  MAIN
      EQUIVALENCE (STAR  , RDATA( 85))                                  MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      EQUIVALENCE (IN    , RDATA( 87))                                  MAIN
      EQUIVALENCE (OLDFMT, RDATA( 88))                                  MAIN
      EQUIVALENCE (FMTSAV, RDATA( 89))                                  MAIN
      EQUIVALENCE (NOLIST, RDATA( 90))                                  MAIN
      EQUIVALENCE (NCOL  , RDATA( 91))                                  MAIN
      EQUIVALENCE (KSTART, RDATA( 92))                                  MAIN
      EQUIVALENCE (PAROPT, RDATA( 93))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (X     , RDATA( 95))                                  MAIN
      EQUIVALENCE (IX    , RDATA( 95))                                  MAIN
      LOGICAL MISXQT                                                    MAIN
      LOGICAL XMSEG                                                     MAIN
      LOGICAL NOLIST                                                    MAIN
      INTEGER TITLE(24)                                                 MAIN
      DATA NOLIST /.FALSE./                                             MAIN
      DATA DLIST /0.0/                                                  MAIN
      LONG=0                                                            MAIN
      CALL XXINIT                                                       MAIN
  100 CONTINUE                                                          MAIN
      READ(5, 1) TITLE                                                  MAIN
    1 FORMAT(8A10)                                                      MAIN
      IF(EOF(5))  200,10                                                MAIN
  200 CONTINUE                                                          MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 201)                                                     MAIN
  201 FORMAT(//////25X, 26H  END OF FILE READING DATA)                  MAIN
      CALL PLOTE(NN)                                                    MAIN
      CALL DBOUT                                                        MAIN
      CALL EXIT                                                         MAIN
   10 CONTINUE                                                          MAIN
      CALL HNSEG                                                        MAIN
      REWIND 25                                                         MAIN
      CALL RNSEG                                                        MAIN
      WRITE(6,6000) NERROR                                              MAIN
 6000 FORMAT( 39H0 END OF NSEGII INPUT FOR CURRENT CASE,  I3,           MAIN
     1           23H INPUT ERRORS DETECTED. )                           MAIN
      IF(IPDICN .GT. 0)   CALL DORDER (.TRUE.)                          MAIN
      IF(NERROR .GT. 0)  GO TO 100                                      MAIN
      REWIND 20                                                         MAIN
      WRITE(20) XNSEG, TAB                                              MAIN
      MISXQT = XMSEG                                                    MAIN
C     DATA BASE RESTORED BY SUBROUTINE SEGOUT AND SUBROUTINE ENSEG      MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM MISION                                                    MAIN
      SUBROUTINE MISION                                                 MAIN
      COMMON/CMPATH/XPATH(203)                                          MAIN
      EQUIVALENCE(XPATH(1),KPATH)                                       MAIN
      COMMON /COMSEG/ XNSEG(650)                                        MAIN
      EQUIVALENCE (XNSEG(  1), XMLOD )                                  MAIN
      EQUIVALENCE (XNSEG(  2), XFLEN )                                  MAIN
      EQUIVALENCE (XNSEG(  3), XMSEG )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(363), IPATMD)                                  MAIN
      EQUIVALENCE(XNSEG(538),LONG )                                     MAIN
      EQUIVALENCE(XNSEG(582),NL    )                                    MAIN
      LOGICAL IPATMD                                                    MAIN
      LOGICAL MGIVEN                                                    MAIN
      LOGICAL XMLOD, XFLEN, XMSEG                                       MAIN
      LONG =0                                                           MAIN
      NL=0                                                              MAIN
      MGIVEN = .TRUE.                                                   MAIN
      CALL FILLPM                                                       MAIN
C     IF(IPATMD) CALL OVERLAY(7LMISSION,3,1)                            MAIN
      IF(IPATMD)  CALL OUTATM                                           MAIN
      IF(XFLEN)  CALL FLITEN                                            MAIN
      KPATH=0                                                           MAIN
C                CALL OVERLAY(7LMISSION,3,2)                            MAIN
      CALL ENSEG                                                        MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM OUTATM                                                    MAIN
      SUBROUTINE OUTATM                                                 MAIN
      COMMON /COMSEG/ XNSEG(500)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(175), INDATM)                                  MAIN
      EQUIVALENCE (XNSEG(363), IPATMD)                                  MAIN
      LOGICAL IPATMD                                                    MAIN
      REAL HEAD(11)                                                     MAIN
      DATA HEAD /1HH, 2HTR, 2HPR, 2HDR, 4HDPDH, 4HDTDH, 4HTEMP, 6HASPEEDMAIN
     1,          3HRHO, 4HPRES, 2HVR/                                   MAIN
      IPATMD = .TRUE.                                                   MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 1) INDATM, HEAD                                          MAIN
    1 FORMAT(10H INDATM = I2/3X, A9, A7, 4(3X, A10), 2A8, 3(3X, A10))   MAIN
      H = 0.0                                                           MAIN
      DH = 1000.                                                        MAIN
   50 CONTINUE                                                          MAIN
      DO 100 I=1,51                                                     MAIN
      CALL ATMOSD                                                       MAIN
      H = H +DH                                                         MAIN
  100 CONTINUE                                                          MAIN
      H = H -DH                                                         MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 1) INDATM, HEAD                                          MAIN
      IF(H .LT. 90000.0)  GO TO 50                                      MAIN
      DH = 5000.                                                        MAIN
  150 CONTINUE                                                          MAIN
      DO 200 I=1,51                                                     MAIN
      CALL ATMOSD                                                       MAIN
      H = H +DH                                                         MAIN
  200 CONTINUE                                                          MAIN
      H = H -DH                                                         MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 1) INDATM, HEAD                                          MAIN
      IF(H .LT. 500000.0)  GO TO 150                                    MAIN
      DH = 10000.                                                       MAIN
  250 CONTINUE                                                          MAIN
      DO 300 I=1,51                                                     MAIN
      CALL ATMOSD                                                       MAIN
      H = H +DH                                                         MAIN
  300 CONTINUE                                                          MAIN
      H = H -DH                                                         MAIN
      IF(H .GT. 1000000.0)  GO TO 400                                   MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 1) INDATM, HEAD                                          MAIN
      GO TO 250                                                         MAIN
  400 CONTINUE                                                          MAIN
      IPATMD = .FALSE.                                                  MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM ENSEG                                                     MAIN
      SUBROUTINE ENSEG                                                  MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      COMMON /COMTAB/ C(3000)                                           MAIN
      COMMON /XQTMIS/ MISXQT                                            MAIN
      LOGICAL MISXQT                                                    MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(154), ISEG  )                                  MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(340), OPTION)                                  MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      EQUIVALENCE (XNSEG(360), LOCRG )                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
C          ***                            ***                           MAIN
C             CONTROLS MISSION SIMULATIONS                              MAIN
C          ***                            ***                           MAIN
      REWIND 20                                                         MAIN
      IF(.NOT. MISXQT)  GO TO 1010                                      MAIN
      READ(20) XNSEG                                                    MAIN
   10 CONTINUE                                                          MAIN
      CALL DUMPTZ(C(LOCTZ))                                             MAIN
C     ........                                                          MAIN
      ISEG = 1                                                          MAIN
      ITZ = 1                                                           MAIN
      CALL PAGHED                                                       MAIN
      CALL SEGINI(1, C(LOCTZ))                                          MAIN
C     ........                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL RGSAVE(C(LOCRG), C(LOCTZ))                                   MAIN
      CALL SEGINI(2, C(LOCTZ))                                          MAIN
  101 CONTINUE                                                          MAIN
      KRG = LOCRG +ITZ -1                                               MAIN
      RANGE = RANGE +C(KRG +5)                                          MAIN
      TIME  = TIME  +C(KRG +3)                                          MAIN
  102 CONTINUE                                                          MAIN
C     ........                                                          MAIN
      ERRET = XNZZ +E10 +E11 -1.0                                       MAIN
C     IF(ERRET .GT. 0.5)  GO TO 1000                                    MAIN
      ISEG = ISEG +1                                                    MAIN
      ITZ = ITZ +10                                                     MAIN
      IF(ITZ +9 .GT. NUMSEG*10)  GO TO 1000                             MAIN
      CALL VOIDXX(C(LOCRG), NSR)                                        MAIN
      IF(NSR .GT. 0)  GO TO 101                                         MAIN
C     ........                                                          MAIN
      CALL UNPACK(C(LOCTZ), C(LOCTZ))                                   MAIN
C     ...                                                               MAIN
      MGIVEN = .TRUE.                                                   MAIN
      CALL XCLECT(OPTION, C(LOCTZ), C(LOCRG), NSR)                      MAIN
      IF(NSR .GT. 0)  GO TO 102                                         MAIN
      GO TO 100                                                         MAIN
C     ...                                                               MAIN
 1000 CONTINUE                                                          MAIN
      CALL SEGOUT(C(LOCTZ), C(LOCRG), C(LOCRG))                         MAIN
 1010 CONTINUE                                                          MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM FLIRAN                                                    MAIN
      SUBROUTINE FLIRAN                                                 MAIN
      COMMON /COMSEG/ XNSEG(650)                                        MAIN
      EQUIVALENCE (XNSEG(612), INDGPC)                                  MAIN
      GO TO (100, 200, 300, 400, 500, 600, 700, 800, 900, 1000), INDGPC MAIN
  100 CONTINUE                                                          MAIN
      CALL FLIENV                                                       MAIN
      GO TO 2                                                           MAIN
C     ...                                                               MAIN
  200 CONTINUE                                                          MAIN
C***  CLIMB PERFORMANCE                                                 MAIN
      CALL FLIXCP                                                       MAIN
      GO TO 2                                                           MAIN
C     ...                                                               MAIN
  300 CONTINUE                                                          MAIN
C     ENDURANCE PERFORMANCE                                             MAIN
      CALL FLIXEP                                                       MAIN
      GO TO 2                                                           MAIN
C     ...                                                               MAIN
  400 CONTINUE                                                          MAIN
C     BEGIN RANGE PERFORMANCE                                           MAIN
      CALL FLIXRP                                                       MAIN
      GO TO 2                                                           MAIN
C     ...                                                               MAIN
  500 CONTINUE                                                          MAIN
C     CONSTANT ALTITUDE-CONSTANT MACH NO. CRUISE                        MAIN
      CALL FLIMHC                                                       MAIN
      GO TO 2                                                           MAIN
C     ...                                                               MAIN
  600 CONTINUE                                                          MAIN
C     TAKE-OFF AND LANDING PERFORMANCE CALCULATIONS                     MAIN
      CALL FLITOL                                                       MAIN
      GO TO 2                                                           MAIN
  700 CONTINUE                                                          MAIN
C     M*L/D CALCULATIONS                                                MAIN
      CALL FLIMLD                                                       MAIN
      GO TO 2                                                           MAIN
  800 CONTINUE                                                          MAIN
C     PERFORMANCE PLOTS                                                 MAIN
C          CALLED FROM FLITEN                                           MAIN
C     CALL PERPLT                                                       MAIN
      GO TO 2                                                           MAIN
  900 CONTINUE                                                          MAIN
      GO TO 2                                                           MAIN
 1000 CONTINUE                                                          MAIN
    2 CONTINUE                                                          MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
C     PROGRAM FLIMAP                                                    MAIN
      SUBROUTINE FLIMAP                                                 MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
C     PERFORMANCE PLOTS                                                 MAIN
      CALL PERPLT                                                       MAIN
C     RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLITEN                                                 MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      EQUIVALENCE (XNSEG(612), INDGPC)                                  MAIN
      EQUIVALENCE (XNSEG(622), IPDGPC)                                  MAIN
      EQUIVALENCE(XNSEG(655),ZMAX10)                                    MAIN
      COMMON/CMPATH/XPATH(203)                                          MAIN
      EQUIVALENCE(XPATH(1),KPATH)                                       MAIN
      LOGICAL IPXX(10)                                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      LOGICAL EOF                                                       MAIN
      LOGICAL TORF                                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CONTROLS GENERALIZED PERFORMANCE CALCULATIONS            MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REWIND 25                                                         MAIN
C     ...                                                               MAIN
    2 CONTINUE                                                          MAIN
      CALL UNIT25(2, EOF)                                               MAIN
      IF(EOF)  GO TO 1111                                               MAIN
      MGIVEN = .TRUE.                                                   MAIN
      TORF = .FALSE.                                                    MAIN
      IF(IPDGPC .GT. 0)  TORF = .TRUE.                                  MAIN
      DO 1 I=1,10                                                       MAIN
      IPXX(I) = TORF                                                    MAIN
    1 CONTINUE                                                          MAIN
      IF(INDGPC .LT. 1  .OR. INDGPC .GT. 10)  GO TO 2                   MAIN
C     IF(INDGPC .NE. 8)  CALL OVERLAY(7LMISSION,3,3)                    MAIN
      IF(INDGPC.NE.8)  CALL FLIRAN                                      MAIN
      IF(INDGPC.NE.8)GO TO 2                                            MAIN
      KPATH=0                                                           MAIN
      ZMAX10=50.                                                        MAIN
C     CALL OVERLAY(7LMISSION,3,4)                                       MAIN
      CALL FLIMAP                                                       MAIN
      GO TO 2                                                           MAIN
 1111 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ALLUSE                                                 MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      COMMON /INXXC/ IP(10), ICASEN, ICASE, IPSET, IXTT                 MAIN
      EQUIVALENCE (TERM( 6), CCPXX)                                     MAIN
      EQUIVALENCE (TERM(10), AOUT )                                     MAIN
      LOGICAL NOEND                                                     MAIN
      INTEGER IP, F, T, CCPXX, AOUT                                     MAIN
      DATA IP, F, T /11*1, 2/                                           MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(10,10HPROPULSIVE,J0001)                               MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HMAX,J0003)                                        MAIN
      GO TO (90003,19), J0003                                           MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      ICASEN = 3                                                        MAIN
      RETURN                                                            MAIN
   19 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HDRY,J0004)                                        MAIN
      GO TO (90004,20), J0004                                           MAIN
90004 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 20                                        MAIN
      CALL QXDEN                                                        MAIN
      ICASEN = 1                                                        MAIN
      RETURN                                                            MAIN
   20 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HWET,J0005)                                        MAIN
      GO TO (90005,21), J0005                                           MAIN
90005 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 21                                        MAIN
      CALL QXDEN                                                        MAIN
      ICASEN = 2                                                        MAIN
      RETURN                                                            MAIN
   21 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(4,4HDUAL,JUMP)                                        MAIN
      GO TO (90055,22),JUMP                                             MAIN
90055 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS) GO TO 22                                       MAIN
      CALL QXDEN                                                        MAIN
      ICASEN = 5                                                        MAIN
      RETURN                                                            MAIN
   22 CONTINUE                                                          MAIN
      CALL FILBCD(LX, X, Z)                                             MAIN
      CALL BCDINT(Z, LX, ICASEN)                                        MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HTHRUST=,J0006)                                    MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      IPSET = 0                                                         MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HMAX,J0007)                                        MAIN
      GO TO (90007,110), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      IPSET = 1                                                         MAIN
      RETURN                                                            MAIN
  110 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HMIN,J0008)                                        MAIN
      GO TO (90008,111), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      IPSET = 2                                                         MAIN
      RETURN                                                            MAIN
  111 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HSPEC,J0009)                                       MAIN
      GO TO (90009,112), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IPSET = 3                                                         MAIN
      RETURN                                                            MAIN
  112 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HSTEPS=,J0010)                                     MAIN
      GO TO (90010,300), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0011)                                          MAIN
      GO TO (90011,300), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, IXTT)                                          MAIN
      RETURN                                                            MAIN
  300 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(6,6HOUTPUT,J0012)                                     MAIN
      GO TO (90012,400), J0012                                          MAIN
90012 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      DO 301 I=1,10                                                     MAIN
      IP(I) = F                                                         MAIN
  301 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HCHECK,J0013)                                      MAIN
      GO TO (90013,310), J0013                                          MAIN
90013 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(1) = T                                                         MAIN
  310 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRFMAX,J0014)                                      MAIN
      GO TO (90014,320), J0014                                          MAIN
90014 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(2) = T                                                         MAIN
  320 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HVMAX,J0015)                                       MAIN
      GO TO (90015,330), J0015                                          MAIN
90015 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(3) = T                                                         MAIN
  330 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HPATH,J0016)                                       MAIN
      GO TO (90016,340), J0016                                          MAIN
90016 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(4) = T                                                         MAIN
  340 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HCLIMB,J0017)                                      MAIN
      GO TO (90017,350), J0017                                          MAIN
90017 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(5) = T                                                         MAIN
  350 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HXCEL,J0018)                                       MAIN
      GO TO (90018,360), J0018                                          MAIN
90018 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(6) = T                                                         MAIN
  360 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HRUN,J0019)                                        MAIN
      GO TO (90019,370), J0019                                          MAIN
90019 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(7) = T                                                         MAIN
  370 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HGOGO,J0020)                                       MAIN
      GO TO (90020,380), J0020                                          MAIN
90020 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(8) = T                                                         MAIN
  380 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HDRAG,JMP)                                         MAIN
      GO TO (90030,390),JMP                                             MAIN
90030 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IP(9)=T                                                           MAIN
  390 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
  400 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(4,4HAERO,J0021)                                       MAIN
      GO TO (90021,500), J0021                                          MAIN
90021 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0022)                                          MAIN
      GO TO (90022,500), J0022                                          MAIN
90022 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0023)                                          MAIN
      GO TO (90023,500), J0023                                          MAIN
90023 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, ICASE)                                         MAIN
      RETURN                                                            MAIN
  500 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HREVERSE,J0024)                                    MAIN
      GO TO (90024,600), J0024                                          MAIN
90024 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      REVCAL = 1.0                                                      MAIN
      RETURN                                                            MAIN
  600 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HEND,J0025)                                        MAIN
      GO TO (90025,700), J0025                                          MAIN
90025 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HMISSION,J0026)                                    MAIN
      GO TO (90026,710), J0026                                          MAIN
90026 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 710                                       MAIN
      CALL QXDEN                                                        MAIN
      INDAC = 1                                                         MAIN
  710 CONTINUE                                                          MAIN
      NOEND = .FALSE.                                                   MAIN
      TERM(7) = REVCAL                                                  MAIN
      AOUT = 0                                                          MAIN
      DO 610 I=1,10                                                     MAIN
      AOUT = AOUT*10 +IP(I)                                             MAIN
  610 CONTINUE                                                          MAIN
      CCPXX = ICASEN*10000 +ICASE*1000 +IPSET*100 +IXTT                 MAIN
  700 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE BERAN                                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      INTEGER PSET, PSSTOR                                              MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES ALTITUDE FOR MAXIMUM RANGE FACTOR             MAIN
C                  GIVEN MACH NUMBER AND WEIGHT                         MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      N=0                                                               MAIN
      PSSTOR=PSET                                                       MAIN
      PSET=0                                                            MAIN
      K=0                                                               MAIN
      CALLTOP                                                           MAIN
      IF(IPXX(1))      WRITE(6,20)                                      MAIN
   20 FORMAT(1H0,1X,*BERAN  WEIGHT  ALTITUDE  MACH     CL    CD     DRAGMAIN
     1   F-REQD  SFC   VEL(KT)   RFAC   Q      QS      F-NET    XNZZ   EMAIN
     210  E11* )                                                        MAIN
      HE=H                                                              MAIN
      DDH=H/10.0                                                        MAIN
      XNZZ=4.0                                                          MAIN
      IF(H.LT.1.0) GO TO 90                                             MAIN
      XNZZ=1.0                                                          MAIN
 1    CALL CRCOMP                                                       MAIN
      SPERL=RFAC                                                        MAIN
    2 SPERH=SPERL                                                       MAIN
      H=H-DDH                                                           MAIN
      CALL CRCOMP                                                       MAIN
      SPERL=RFAC                                                        MAIN
      N=N+1                                                             MAIN
      IF(SPERL-SPERH)3,3,4                                              MAIN
    4 IF(N-10)2,60,60                                                   MAIN
 3    IF(K-1)10,11,11                                                   MAIN
 10   HT=AMIN1(HE,H+2.0*DDH)                                            MAIN
      DDH=(HT-H)/10.0                                                   MAIN
      H=HT                                                              MAIN
      N=0                                                               MAIN
      K=2                                                               MAIN
      GOTO1                                                             MAIN
 11   HL=H                                                              MAIN
      HT=AMIN1(HE,H+2.0*DDH)                                            MAIN
      H=HT                                                              MAIN
      CALL CRCOMP                                                       MAIN
      SPERH=RFAC                                                        MAIN
      H=.5*(HL+HT)                                                      MAIN
      CALL CRCOMP                                                       MAIN
      Y2=RFAC                                                           MAIN
      IF(Y2.LT.SPERH) GO TO 62                                          MAIN
      CALL XFIT2(HL,H,HT,SPERL,Y2,SPERH,AA,BB,CC,H,YM,XR,XRR)           MAIN
      IF(HT-H)62,61,61                                                  MAIN
  62  H=HT                                                              MAIN
      GOTO61                                                            MAIN
   60 H=0.0                                                             MAIN
 61   CALL CRCOMP                                                       MAIN
      CLC=CL                                                            MAIN
      PSET=PSSTOR                                                       MAIN
 90   RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CHECK                                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 73), AN    )                                  MAIN
      EQUIVALENCE (XNSEG( 74), ACG   )                                  MAIN
      EQUIVALENCE (XNSEG( 75), ACV   )                                  MAIN
      EQUIVALENCE (XNSEG(173), A1    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(123), W     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(157), YZA   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(180), PR    )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              PROVIDES INSTANTANEOUS CONDITIONS WHEN LIFT EQUALS WEIGHTMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      NCD=XQBD                                                          MAIN
      GOTO(1,2,3,4,6,7,8),NCD                                           MAIN
 1    CL=WT/QS                                                          MAIN
      GO TO 5                                                           MAIN
  2   PR=WT/(XQSW*1481.352*CLC*AM**2)                                   MAIN
      CALL XALT                                                         MAIN
      CALL ATMOSD                                                       MAIN
   3  QS=WT/CLC                                                         MAIN
      AM = SQRT(QS/(XQSW*QMSQR))                                        MAIN
      CL=CLC                                                            MAIN
    5 VX=AM*ASPEED                                                      MAIN
      CALL DRAG                                                         MAIN
      AN=0.0                                                            MAIN
      PS=DRT                                                            MAIN
      CALL ENDAT                                                        MAIN
      CLCD=WT/DRT                                                       MAIN
      VN=VX*.59208                                                      MAIN
      RFAC=CLCD*VN/SFC                                                  MAIN
      IF(IPXX(1))  CALL OUTXXX(1)                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
 4    CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      AN=0.0                                                            MAIN
      VX=AM*ASPEED                                                      MAIN
      CALL ENDAT                                                        MAIN
      CL=W/QS                                                           MAIN
      CALL DRAG                                                         MAIN
      ACV=(FN-DRT)*32.2/W                                               MAIN
      VN=VX*.59208                                                      MAIN
      ACG=ACV/32.2                                                      MAIN
      A1=ACV                                                            MAIN
      CLCD=WT/DRT                                                       MAIN
      XNZZ = 1.0                                                        MAIN
      IF(ACV*YZA .LT. 0.0)  XNZZ = 3.0                                  MAIN
      IF(ACV*YZA .EQ. 0.0)  XNZZ = 2.0                                  MAIN
      IF(IPXX(1))  CALL OUTXXX(1)                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
    6 CONTINUE                                                          MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      CLC=WT/QS                                                         MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
 7    PR=WT/(XQSW*1481.352*CLC*AM**2)                                   MAIN
      CALL XALT                                                         MAIN
    8 CONTINUE                                                          MAIN
      CALL ATMOSD                                                       MAIN
      QS=WT/CLC                                                         MAIN
      AM = SQRT(QS/(XQSW*QMSQR))                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CRCOMP                                                 MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      EQUIVALENCE  (XNSEG(92),FN),(XNSEG(264),CD)                       MAIN
      LOGICAL IPXX(10)                                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE                   (ATMOS(8),Q),(ATMOS(16),VEL)        MAIN
      CALLALTA                                                          MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WT/QS                                                          MAIN
      CALLDRAG                                                          MAIN
      PS=DRT                                                            MAIN
      CALLENDAT                                                         MAIN
      RFAC=VEL*WT/(DRT*SFC)                                             MAIN
      IF(IPXX(1))  WRITE(6,21) WT,H,AM,CL,CD,DRT,PS,SFC,VEL,RFAC,Q,     MAIN
     1                         QS,FN,XNZZ,E10,E11                       MAIN
   21 FORMAT(1H ,6X,F8.0,1X,F8.0,1X,F6.2,1X,F6.3,1X,F6.3,1X,F6.0,1X,F8.0MAIN
     1,F7.3,1X,F6.0,1X,F5.0,1X,F5.0,1X,G9.2,1X,F8.0,2X,3(1X,F4.1) )     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DRAG                                                   MAIN
C     THIS SUBROUTINE PROVIDES THE FOLLOWING PROGRAM NSEG AERODYNAMIC   MAIN
C     OPTIONS                                                           MAIN
C                                                                       MAIN
C        INDAER = 8, CD = CDO + (DCD/DCL**2)*CL**2                      MAIN
C                                                                       MAIN
C        INDAER = 9, CD = CDO + K1*CL**2 + K2*(CL - CLD)**2 + K3*CL**3 +MAIN
C                                                                       MAIN
C     NSTORE .NE. 0, ADDS ON EXTERNAL STORE DRAGS TO EITHER OPTION 8 OR MAIN
C                                                                       MAIN
C     NTANKS .NE. 0, ADDS ON EXTERNAL TANK DRAGS TO EITHER OPTION 8 OR 9MAIN
C                                                                       MAIN
C     INDAER OPTIONS 1 TO 7 ARE RESERVED FOR THE ATOP PROGRAM.          MAIN
C                                                                       MAIN
C                                                                       MAIN
C     INDAER       AERODYNAMIC OPTION INDICATOR                         MAIN
C     CL           LIFT COEFFICIENT                                     MAIN
C     CD           DRAG COEFFICIENT                                     MAIN
C     CDSTOR       STORE DRAG COEFFICIENT                               MAIN
C     CDTANK       TANK DRAG COEFFICIENT                                MAIN
C     DRT          TOTAL DRAG                                           MAIN
C     QS           PRODUCT OF AERODYNAMIC REFERENCE AREA AND DYNAMIC PREMAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(263), INDAER)                                  MAIN
      EQUIVALENCE (XNSEG(264), CD    )                                  MAIN
      EQUIVALENCE (XNSEG(265), CDSTOR)                                  MAIN
      EQUIVALENCE (XNSEG(266), CDTANK)                                  MAIN
      EQUIVALENCE   (XNSEG(176),ASPEED ),(XNSEG(94),ALT    )            MAIN
      EQUIVALENCE   (XNSEG(85),DRT     )                                MAIN
      EQUIVALENCE   (XNSEG(72),AMACH   ),(XNSEG(124),WT    )            MAIN
      EQUIVALENCE   (XNSEG(122),VX     ),(XNSEG(79),CL     )            MAIN
      EQUIVALENCE   (XNSEG(750),CLOUT  )                                MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      EQUIVALENCE  (XNSEG(349),IPXX)                                    MAIN
      LOGICAL  IPXX(10)                                                 MAIN
      INTEGER LOCSAC(50)                                                MAIN
C                                                                       MAIN
      DATA RE,GZERO/20925400.,32.1739/                                  MAIN
      CLSAVE = CL                                                       MAIN
C     MODIFY CL FOR CENTRIFUGAL ACCELERATION EFFECT.                    MAIN
      FCENT=0.0                                                         MAIN
      IF(QS.LT.0.1) GO TO 10                                            MAIN
      FCENT = WT*VX*VX*((RE + ALT)    )/(GZERO*RE**2)                   MAIN
      CL = CL - FCENT/QS                                                MAIN
 10   CONTINUE                                                          MAIN
      CLOUT = CL                                                        MAIN
      CD = 0.0                                                          MAIN
      IF(INDAER.EQ.0)  GO TO 33                                         MAIN
      IF(INDAER .EQ. 8)  GO TO 3800                                     MAIN
      IF(INDAER .EQ. 9)  GO TO 3900                                     MAIN
      WRITE(6, 3010) INDAER                                             MAIN
 3010 FORMAT(35H     ENTRY TO SACSNS WITH INDAER = I2, 5H EXIT)         MAIN
      CALL EXIT                                                         MAIN
 3800 CONTINUE                                                          MAIN
      CALL SACNS1                                                       MAIN
      GO TO 3950                                                        MAIN
 3900 CONTINUE                                                          MAIN
      CALL SACNS2                                                       MAIN
 3950 CONTINUE                                                          MAIN
C                                                                       MAIN
C            COMPUTES EXTERNAL STORE DRAGS                              MAIN
      CALL SACSP                                                        MAIN
C                                                                       MAIN
C            COMPUTES EXTERNAL TANK DRAG                                MAIN
      CALL SACTP                                                        MAIN
C                                                                       MAIN
      CD = CD + CDSTOR + CDTANK                                         MAIN
      DRT = CD*QS                                                       MAIN
      IF(DRT .LE. 0.0)  DRT = 1.0                                       MAIN
      IF(IPXX(9) ) WRITE (6,123)  AMACH,ALT,WT,VX,ASPEED,CL,CD,         MAIN
     1                            CDSTOR,CDTANK,QS                      MAIN
  123 FORMAT(1H ,1X,*DRAG---MACH,H,WT,VX,ASPEED,CL,CD,CDSTOR,CDTANK,QS *MAIN
     1,F6.2,1X,F8.0,1X,F9.0,1X,F7.0,1X,F7.0,/1H ,5(1X,G10.3) )          MAIN
   33 CL = CLSAVE                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE EDCLMB                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE  (XNSEG(191),V    ),(XNSEG(193),MGIVEN  )             MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(651), ENDPTH)                                  MAIN
      LOGICAL  CANFLY,MGIVEN                                            MAIN
      NAME LIST /DBEDOT/ I, K, AMS, H0, AME, HE, WT, DELW, SE, DELSE,   MAIN
     1                   EDOT1                                          MAIN
      DATA TWOG /64.4/                                                  MAIN
      CALL INIMHP                                                       MAIN
      H = HE                                                            MAIN
      AM = AME                                                          MAIN
      CALL ATMOSD                                                       MAIN
      SE2 = HE +SPEED**2/TWOG                                           MAIN
      H = H0                                                            MAIN
      AM = AMS                                                          MAIN
      CALL ATMOSD                                                       MAIN
      SE1 = H0 +SPEED**2/TWOG                                           MAIN
      NUMSE = 20                                                        MAIN
      DELSE = (SE2 -SE1)/NUMSE                                          MAIN
      SE = SE1                                                          MAIN
      K = 1                                                             MAIN
C                                                                       MAIN
      DO 100 I=1,NUMSE                                                  MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT1 = (FN -DRT)*SPEED/WT                                        MAIN
      DELW = FFR*DELSE/(3600.0*EDOT1)                                   MAIN
      SE = SE +DELSE                                                    MAIN
      CALL EDMHPT(WT-DELW, SE, HE, AME, CANFLY)                         MAIN
      IF(CANFLY)  GO TO 2                                               MAIN
      WRITE(6, DBEDOT)                                                  MAIN
      GO TO 100                                                         MAIN
    2 CONTINUE                                                          MAIN
      IF(DELSE .GT. 0.0  .AND.  HE .GT. ENDPT(2)  .AND.                 MAIN
     1                                  ENDPTH .LE. 0.0)  HE = ENDPT(2) MAIN
      IF(DELSE .LE. 0.0  .AND.  HE .LT. ENDPT(2))  HE = ENDPT(2)        MAIN
      IF(ENDPT(2).NE.HE )  GO TO 50                                     MAIN
C     END ALTITUDE REACHED -- ACCELERATE OR DECELERATE                  MAIN
      H=HE                                                              MAIN
      V=0.5921*SQRT (TWOG * (SE - HE) )                                 MAIN
      MGIVEN =.FALSE.                                                   MAIN
      CALL ATMOSD                                                       MAIN
      AME = AM                                                          MAIN
   50 CONTINUE                                                          MAIN
      CALL FLYMHP                                                       MAIN
      H0 = HE                                                           MAIN
      AMS = AME                                                         MAIN
  100 CONTINUE                                                          MAIN
C                                                                       MAIN
      DELH = ABS(ENDPT(2) - HE)                                         MAIN
      DELM = ABS(ENDPT(1) - AME)                                        MAIN
      IF( (DELH.LT. 10.) .AND. (DELM.LT.0.01) ) GO TO 150               MAIN
      AME = ENDPT(1)                                                    MAIN
      HE = ENDPT(2)                                                     MAIN
      CALL FLYMHP                                                       MAIN
  150 CONTINUE                                                          MAIN
      CALL MHPTAB(1)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE EDMHPT(WT, SE, HPT, AMPT, CANFLY)                      MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(192), VELA  )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(658), EDOT  )                                  MAIN
      EQUIVALENCE  (XNSEG(349),IPXX)                                    MAIN
      LOGICAL  IPXX(10)                                                 MAIN
      REAL LIFT                                                         MAIN
      REAL LOD, LOD1, LOD2, LOD3                                        MAIN
      REAL LOTMD, LOTMD1, LOTMD2, LOTMD3                                MAIN
      REAL Y(5)                                                         MAIN
      COMMON /YICSET/       Y1(5), Y2(5), Y3(5)                         MAIN
      EQUIVALENCE (Y(1), EDOT), (Y(2), EDOMD), (Y(3), LOD), (Y(4), RF)  MAIN
      EQUIVALENCE (Y(5), LOTMD)                                         MAIN
      EQUIVALENCE (Y1(1), EDOT1 ), (Y2(1), EDOT2 ), (Y3(1), EDOT3 )     MAIN
      EQUIVALENCE (Y1(2), EDOMD1), (Y2(2), EDOMD2), (Y3(2), EDOMD3)     MAIN
      EQUIVALENCE (Y1(3), LOD1  ), (Y2(3), LOD2  ), (Y3(3), LOD3  )     MAIN
      EQUIVALENCE (Y1(4), RF1   ), (Y2(4), RF2   ), (Y3(4), RF3   )     MAIN
      EQUIVALENCE (Y1(5), LOTMD1), (Y2(5), LOTMD2), (Y3(5), LOTMD3)     MAIN
      LOGICAL CANFLY                                                    MAIN
      LOGICAL MGIVEN                                                    MAIN
      DATA TWOG /64.4/                                                  MAIN
      CANFLY = .TRUE.                                                   MAIN
      LIFT = WT                                                         MAIN
      IF(IPXX(5))  WRITE(6,1)                                           MAIN
    1 FORMAT(1H0,*EDMHPT---IPOINT,MACH,ALT,V(FPS),DRAG,F-NET,FFR,L/D,   MAIN
     1EDOT*)                                                            MAIN
      NCOMP = SE/20000.                                                 MAIN
      IF(NCOMP.LT.20)  NCOMP=20                                         MAIN
      XNCOMP=NCOMP                                                      MAIN
      DELV=SQRT(TWOG*SE)/XNCOMP                                         MAIN
      SPEED = 0.0                                                       MAIN
      MGIVEN = .FALSE.                                                  MAIN
      CALL SETYIC(Y)                                                    MAIN
      YMAX = -0.0                                                       MAIN
      SPEEDO = -0.0                                                     MAIN
      SPEED1 = -0.0                                                     MAIN
      SPEED2 = -0.0                                                     MAIN
      SPEED3 = -0.0                                                     MAIN
      H1 = -0.0                                                         MAIN
      H2 = -0.0                                                         MAIN
      H3 = -0.0                                                         MAIN
      COEFA = -0.0                                                      MAIN
      COEFB = -0.0                                                      MAIN
      COEFC = -0.0                                                      MAIN
      JJ = 0                                                            MAIN
      DO 50 J=1,NCOMP                                                   MAIN
      SPEED = SPEED +DELV                                               MAIN
      VEL = 0.5921*SPEED                                                MAIN
      H = SE -SPEED**2/TWOG                                             MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      IF(CL .GT. CLMAX)  GO TO 50                                       MAIN
      LIM=0                                                             MAIN
      IF(Q .GT. QLIM)  GO TO 49                                         MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
C     IF(EDOT .LE. 0.0)  GO TO 50                                       MAIN
      IF(FFR.LE.0.00001)  GO TO 47                                      MAIN
      EDOMD = EDOT*3600.0/FFR                                           MAIN
      RF = (LIFT/DRT)*(VEL/SFC)                                         MAIN
   47 CONTINUE                                                          MAIN
      LOD = LIFT/DRT                                                    MAIN
      LOTMD = 1.0E20                                                    MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 48                              MAIN
      LOTMD = LIFT/(FN -DRT)                                            MAIN
   48 CONTINUE                                                          MAIN
      IF(Y(INDMHP) .LT. Y2(INDMHP))  GO TO 50                           MAIN
      EDOT2 = EDOT                                                      MAIN
      EDOMD2 = EDOMD                                                    MAIN
      LOD2 = LOD                                                        MAIN
      RF2 = RF                                                          MAIN
      LOTMD2 = LOTMD                                                    MAIN
      SPEED2 = SPEED                                                    MAIN
      H2 = H                                                            MAIN
      GO TO 50                                                          MAIN
 49   LIM=1                                                             MAIN
   50 CONTINUE                                                          MAIN
C     COMPUTE MACH ALTITUDE POINT FOR THIS SPECIFIC ENERGY              MAIN
      SPEEDO=SPEED2                                                     MAIN
      H=SE - SPEED2**2/TWOG                                             MAIN
      IND=2                                                             MAIN
      AM=SPEED2*0.5921/VELA                                             MAIN
      IF(.NOT.IPXX(5))  GO TO 51                                        MAIN
      WRITE(6,6666)  IND,AM,H,SPEED2,PS,FN,FFR,LOD2,EDOT2               MAIN
   51 CONTINUE                                                          MAIN
      IF(SPEED2.LE.0.01)  GO TO 200                                     MAIN
C     IF MAX POINT IS FIRST NONZERO VELOCITY POINT COMPUTATIONS WILL    MAIN
C     BLOW UP.  THEREFORE, CURVE FIT IS SKIPPED.                        MAIN
      IF(SPEED2.LE.DELV)  GO TO 60                                      MAIN
      SPEED1 = SPEED2 -DELV                                             MAIN
      SPEED3 = SPEED2 +DELV                                             MAIN
      H1 = SE -SPEED1**2/TWOG                                           MAIN
      H3 = SE -SPEED3**2/TWOG                                           MAIN
      VEL = 0.5921*SPEED1                                               MAIN
      H = H1                                                            MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(FFR.LE.0.001)  GO TO 60                                        MAIN
      EDOT1 = (FN -DRT)*SPEED1/WT                                       MAIN
      EDOMD1 = EDOT1*3600.0/FFR                                         MAIN
      LOD1 = LIFT/DRT                                                   MAIN
      IND = 1                                                           MAIN
      IF(.NOT.IPXX(5))  GO TO 52                                        MAIN
      WRITE(6,6666)  IND,AM,H,SPEED1,PS,FN,FFR,LOD1,EDOT1               MAIN
   52 CONTINUE                                                          MAIN
      RF1 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD1 = 1.0E20                                                   MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 55                              MAIN
      LOTMD1 = LIFT/(FN -DRT)                                           MAIN
   55 CONTINUE                                                          MAIN
      VEL = 0.5921*SPEED3                                               MAIN
      H = H3                                                            MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(FFR.LT.0.001)  GO TO 60                                        MAIN
      EDOT3 = (FN -DRT)*SPEED3/WT                                       MAIN
      EDOMD3 = EDOT3*3600.0/FFR                                         MAIN
      LOD3 = LIFT/DRT                                                   MAIN
      IND = 3                                                           MAIN
      IF(.NOT.IPXX(5))  GO TO 53                                        MAIN
      WRITE(6,6666)  IND,AM,H,SPEED3,PS,FN,FFR,LOD3,EDOT3               MAIN
   53 CONTINUE                                                          MAIN
      RF3 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD3 = 1.0E20                                                   MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 58                              MAIN
      LOTMD3 = LIFT/(FN -DRT)                                           MAIN
   58 CONTINUE                                                          MAIN
      IF(Q.GT.QLIM)  LIM=1                                              MAIN
      IF(LIM.NE.0) GO TO 60                                             MAIN
      CALL XFIT2(SPEED1, SPEED2, SPEED3,                                MAIN
     1           Y1(INDMHP), Y2(INDMHP), Y3(INDMHP),                    MAIN
     1           COEFA, COEFB, COEFC,                                   MAIN
     1           SPEEDO, YMAX, DUM, DUM)                                MAIN
 60   CONTINUE                                                          MAIN
      VEL = 0.5921*SPEEDO                                               MAIN
      H = SE -SPEEDO**2/TWOG                                            MAIN
      IF(H .LE. 0.0)  H = 0.0                                           MAIN
      CALL ATMOSD                                                       MAIN
      HPT = H                                                           MAIN
      AMPT = AM                                                         MAIN
      MGIVEN = .TRUE.                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
      LOD=LIFT/DRT                                                      MAIN
      IND = 0                                                           MAIN
      IF(.NOT.IPXX(5))  GO TO 54                                        MAIN
      WRITE(6,6666)  IND,AM,H,SPEEDO,PS,FN,FFR,LOD,EDOT                 MAIN
   54 CONTINUE                                                          MAIN
 6666 FORMAT(1H ,5X,I5,2X,8(1X,G12.5) )                                 MAIN
      IF(CL .GT. CLMAX)  GO TO 200                                      MAIN
      IF(Q .GT. QLIM)  GO TO 200                                        MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      MGIVEN = .TRUE.                                                   MAIN
      WRITE(6, 100)                                                     MAIN
  100 FORMAT(64H0 WARNING   ***   THE VEHICLE CAN NOT FLY AT THE ABOVE CMAIN
     1ONDITION)                                                         MAIN
      CANFLY = .FALSE.                                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLYMHP                                                 MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     1                PVEL(25), ENDPT(2)                                MAIN
      COMMON /CENDAT/ CFNET(25),CSFC(25)                                MAIN
      EQUIVALENCE  (XNSEG(92),FN),(XNSEG(115),SFC)                      MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 93), FWC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(129), XA0   )                                  MAIN
      EQUIVALENCE (XNSEG(130), XA1   )                                  MAIN
      EQUIVALENCE (XNSEG(131), XA2   )                                  MAIN
      EQUIVALENCE (XNSEG(132), XA3   )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      H0 = HPATH(K)                                                     MAIN
      AMS = AMPATH(K)                                                   MAIN
      K = K +1                                                          MAIN
      AMPATH(K) = AME                                                   MAIN
      HPATH(K) = HE                                                     MAIN
      MGIVEN = .TRUE.                                                   MAIN
      SAVXTT = XTT                                                      MAIN
      XTT = 2.0                                                         MAIN
      DELH = ABS(HE -H0)                                                MAIN
      IF(DELH .LE. 1.0)  GO TO 100                                      MAIN
      FACTOR = DELH/1000.0                                              MAIN
      IF(FACTOR .GT. 2.0)  XTT = FACTOR                                 MAIN
      IF(XTT .GT. 40.0)  XTT = 40.0                                     MAIN
      XQFP = 2.1                                                        MAIN
      XA1 = (AME -AMS)/(HE -H0)                                         MAIN
      XA0 = AME -XA1*HE                                                 MAIN
      XA2 = 0.0                                                         MAIN
      XA3 = 0.0                                                         MAIN
      CALL CLIMB                                                        MAIN
      IF(ABS(RXC).GT.0.001)  GO TO 50                                   MAIN
      PGAM7D(K) = 90.*(HE - H0)*REVFLG/ABS(HE - H0)                     MAIN
      GO TO 51                                                          MAIN
   50 CONTINUE                                                          MAIN
      PGAM7D(K) = ATAN((HE-H0)/(RXC*6080.1))*57.29577951                MAIN
   51 CONTINUE                                                          MAIN
      H = HE                                                            MAIN
      AM = AME                                                          MAIN
      CALL ATMOSD                                                       MAIN
      CFNET(K)=FN                                                       MAIN
      CSFC(K)=SFC                                                       MAIN
      PVEL(K) = VEL                                                     MAIN
      CRANGE(K) = CRANGE(K-1) +RXC                                      MAIN
      CTIME(K) = CTIME(K-1) +TTC*60.0                                   MAIN
      CFUEL(K) = CFUEL(K-1) +FWC                                        MAIN
      CUMWT(K) = WT                                                     MAIN
      XTT = SAVXTT                                                      MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
      XTT = 10.0                                                        MAIN
      DAC = 0.0                                                         MAIN
      TAC = 0.0                                                         MAIN
      DELAM = ABS( AME - AMS )                                          MAIN
      IF(DELAM .GT. 0.0001)  CALL XCEL                                  MAIN
      CRANGE(K) = CRANGE(K-1) +DAC                                      MAIN
      CTIME(K) = CTIME(K-1) +TAC*60.0                                   MAIN
      CUMWT(K) = WT                                                     MAIN
      DW = CUMWT(K-1) -CUMWT(K)                                         MAIN
      CFUEL(K) = CFUEL(K-1) +DW                                         MAIN
      PGAM7D(K) = 0.0                                                   MAIN
      H = HPATH(K)                                                      MAIN
      AM = AMPATH(K)                                                    MAIN
      CALL ATMOSD                                                       MAIN
      PVEL(K) = VEL                                                     MAIN
      XTT = SAVXTT                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MHPTAB(IPATHX)                                         MAIN
      COMMON /CCRUZ/PRFAC(25)                                           MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      COMMON /CENDAT/ CFNET(25),CSFC(25)                                MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      INTEGER  CRHEAD(11)                                               MAIN
      INTEGER CMHEAD(10)                                                MAIN
      INTEGER ONE(5)                                                    MAIN
      INTEGER TWO(5)                                                    MAIN
      INTEGER KIND(3)                                                   MAIN
      DATA CMHEAD /6HTIME  , 6HRANGE , 6HWEIGHT, 6HFUEL  ,              MAIN
     1             8HALTITUDE, 8HMACH NO., 9HV (KNOTS), 6HGAM7D ,       MAIN
     2             10HNET THRUST,7H    SFC/                             MAIN
      DATA CRHEAD /6HTIME  ,6HRANGE ,6HWEIGHT,6HFUEL  ,8HALTITUDE,      MAIN
     18HMACH NO.,9HV (KNOTS),6HGAMMA ,10HNET THRUST,7H    SFC,          MAIN
     26H  RFAC/                                                         MAIN
      DATA ONE /4HEDOT, 9HEDOT/MDOT, 9HLIFT/DRAG, 10HRANGE FACT,        MAIN
     1          10HLIFT/(THRU/                                          MAIN
      DATA TWO /1H , 1H , 1H , 2HOR, 9HST -DRAG)/                       MAIN
      DATA KIND /6HENERGY, 8HALTITUDE, 8HMACH NO./                      MAIN
      CALL PAGHED                                                       MAIN
C     FLIGHT PATH ANGLE AVERAGING LOOP.                                 MAIN
      PGAM7D(1) = PGAM7D(2)                                             MAIN
      PGAM7D(KPATH + 1) = PGAM7D(KPATH)                                 MAIN
      DO 10 I=1,KPATH                                                   MAIN
   10 PGAM7D(I) = ( PGAM7D(I) + PGAM7D(I+1) )*0.5                       MAIN
      IF(IPATHX .GE. 4)  GO TO 190                                      MAIN
      WRITE(6, 100) KIND(IPATHX)                                        MAIN
  100 FORMAT(49H SEARCH FOR MACH ALTITUDE POINT ALONG A CONSTANT A8,    MAIN
     1       5H LINE)                                                   MAIN
      WRITE(6, 150) ONE(INDMHP), TWO(INDMHP)                            MAIN
  150 FORMAT(66H0 THE BASIS FOR SELECTION OF EACH MACH ALTITUDE POINT WAMAIN
     1S MAXIMUM 2A10)                                                   MAIN
      WRITE(6, 170)                                                     MAIN
  170 FORMAT(1H0, 60X, 19H CLIMB PATH HISTORY)                          MAIN
      GO TO 199                                                         MAIN
  190 CONTINUE                                                          MAIN
      IF(IPATHX .EQ. 4)  WRITE(6, 195)                                  MAIN
  195 FORMAT(1H0, 42X, 40H LINEAR MACH ALTITUDE CLIMB PATH HISTORY)     MAIN
      IF(IPATHX .EQ. 5)  WRITE(6, 196)                                  MAIN
  196 FORMAT(1H0, 40X, 45H CONSTANT DYNAMIC PRESSURE CLIMB PATH HISTORY)MAIN
      IF(IPATHX.NE.6)  GO TO 199                                        MAIN
      WRITE(6,197)                                                      MAIN
  197 FORMAT(1H0,46X,* CRUISE AT MAXIMUM RANGE FACTOR *)                MAIN
      WRITE (6,230)  CRHEAD                                             MAIN
  200 FORMAT(1H0,10(2X,A10))                                            MAIN
  230 FORMAT(1H0,11(1X,A10))                                            MAIN
      WRITE(6,220)  (CTIME(I),CRANGE(I),CUMWT(I),CFUEL(I),HPATH(I),     MAIN
     1               AMPATH(I),PVEL(I),PGAM7D(I),CFNET(I),CSFC(I),      MAIN
     2               PRFAC(I), I=1,KPATH)                               MAIN
      GO TO 30                                                          MAIN
  220 FORMAT(1H0,F7.3,1X,G12.5,1X,F9.0,1X,G11.4,1X,F8.0,                MAIN
     1      4X,F7.3,5X,F6.0,5X,F6.2,4X,G14.7,1X,G12.5,1X,G10.3)         MAIN
  199 CONTINUE                                                          MAIN
      WRITE(6, 200) CMHEAD                                              MAIN
      WRITE(6, 210) (CTIME(I), CRANGE(I), CUMWT(I), CFUEL(I), HPATH(I), MAIN
     1               AMPATH(I), PVEL(I), PGAM7D(I),CFNET(I),CSFC(I),    MAIN
     2               I=1,KPATH)                                         MAIN
  210 FORMAT(1H0, 3X, F7.3, 2X,G12.5, 3X, F9.0, 2X,G11.4, 2X, F8.0,     MAIN
     1       5X, F7.3, 6X, F6.0, 6X, F6.2,1X,G14.7,1X,G12.5)            MAIN
   30 CONTINUE                                                          MAIN
      AMS = AMPATH(1)                                                   MAIN
      AME = ENDPT(1)                                                    MAIN
      H0 = HPATH(1)                                                     MAIN
      HE = ENDPT(2)                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX4(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /CCRUZ/PRFAC(25)                                           MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     1                PVEL(25), ENDPT(2)                                MAIN
      COMMON /CENDAT/ CFNET(25),CSFC(25)                                MAIN
      EQUIVALENCE  (XNSEG(92),FN),(XNSEG(115),SFC)                      MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(232), TCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(233), RCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      KPATH = 0                                                         MAIN
 4    W1=WT                                                             MAIN
      WTKEP=WT                                                          MAIN
      PSET=0.0                                                          MAIN
      XQFP=1.0                                                          MAIN
      IF(TZ(ITZ +6) .GT. 0.5)  GO TO 42                                 MAIN
   41 W2 = TZ(ITZ +2)                                                   MAIN
      XQBD=5.0                                                          MAIN
      CALL CHECK                                                        MAIN
 44   CALL RUN                                                          MAIN
      RN=ABS(RN)                                                        MAIN
      TTR=ABS(TTR)                                                      MAIN
      CALL MHPTAB(6)                                                    MAIN
      RETURN                                                            MAIN
   42 DWW = (WT -TZ(ITZ +2))/5.0                                        MAIN
      DO 43 I=1,5                                                       MAIN
      W1=WT                                                             MAIN
      W2=W1-DWW                                                         MAIN
      RC=TZ(8)                                                          MAIN
      CALL BERAN                                                        MAIN
      CALL RUN                                                          MAIN
      IF( E10 +E11 +XNZZ .GT. 1.0)  RETURN                              MAIN
      RCMAX=RCMAX+RN                                                    MAIN
 43   TCMAX=TCMAX+TTR                                                   MAIN
      RN=0.0                                                            MAIN
      TTR=0.0                                                           MAIN
      RCMAX=ABS(RCMAX)                                                  MAIN
      TCMAX=ABS(TCMAX)                                                  MAIN
      CALL MHPTAB(6)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OUTXXX(N)                                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 73), AN    )                                  MAIN
      EQUIVALENCE (XNSEG( 74), ACG   )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG( 99), PQ1   )                                  MAIN
      EQUIVALENCE (XNSEG(100), PQ2   )                                  MAIN
      EQUIVALENCE (XNSEG(111), RCM   )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(136), XQAE  )                                  MAIN
      EQUIVALENCE (XNSEG(137), XQA1  )                                  MAIN
      EQUIVALENCE (XNSEG(148), XQW1  )                                  MAIN
      EQUIVALENCE (XNSEG(149), XQW2  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(582), NL    )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              PRINTS RESULTS FROM CHECK, PATH, RUN, GOGO, XCEL, CLIMB  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      ANGA=AN*57.3                                                      MAIN
      PQ1=TTC+TTR*60.0+TAC*60.0                                         MAIN
      PQ2=RXC+RN+DAC                                                    MAIN
C     ...                                                               MAIN
      GO TO (1, 2, 3, 4, 5, 6, 7, 8, 9, 10), N                          MAIN
    1 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 11)                                       MAIN
 11   FORMAT(1H0,2X,6HCHECK 2X,41H TIME  RANGE  WEIGHT ALTITUDE MACH   CMAIN
     1L  5X,23H  DRAG     FN     SFC  3X,21H  ACG    L/D  VEL(KT)2X,12HXMAIN
     2NZZ E10 E11)                                                      MAIN
 21   WRITE(6,31)PQ1,PQ2,WT,H,AM,CL,DRT,PS,SFC,ACG,CLCD,VN,XNZZ,E10,E11 MAIN
 31   FORMAT(1H ,2X,2F10.3,F9.0,F9.0,F6.2,F6.3,5X,2F9.0,F7.3,3X,F7.4,F7.MAIN
     12,F7.0,3X,3F5.1)                                                  MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
C     ...                                                               MAIN
    2 CONTINUE                                                          MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
    3 CONTINUE                                                          MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
    4 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 12)                                       MAIN
 12   FORMAT(1H0,2X,6HPATH  2X,41H TIME  RANGE  WEIGHT ALTITUDE MACH   CMAIN
     1L  5X,23H  DRAG   THRUST   SFC  3X,21H  RCM    ANG  OVER PR3X,12HXMAIN
     2NZZ E10 E11)                                                      MAIN
 22   WRITE (6,32)PQ1,PQ2,WT,H,AM,CL,DRT,FN,SFC,RCM,ANGA,YZJ,XNZZ       MAIN
     1,                            E10, E11                             MAIN
 32   FORMAT(1H ,2X,2F10.3,F9.0,F8.0,F6.2,F6.3,5X,2F8.0,F7.3,3X,F7.0,F7.MAIN
     12,F9.2,1X,3F4.0)                                                  MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
C     ...                                                               MAIN
    5 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 13)                                       MAIN
  13  FORMAT(1H0,2X,6HCLIMB 2X,43H INT  H  END H  TYPE  ALT    WEIGHT  MMAIN
     1ACH  5X,14H RANGE   TIME 3X,12HXNZZ E10 E11)                      MAIN
  23  CONTINUE                                                          MAIN
      WRITE (6,33)H0,HE,XQFP,H,WT,AM,RXC,TTC,XNZZ,E10,E11               MAIN
 33   FORMAT(1H ,10X,2F8.0,F4.0,2F8.0,F7.3,5X,2F7.3,3X,3F4.0)           MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
C     ...                                                               MAIN
    6 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 15)                                       MAIN
  15  FORMAT(1H0,2X,6HXCEL  2X,43H INT  M  END M        ALT    WEIGHT  MMAIN
     1ACH  5X,14H RANGE   TIME 3X,12HXNZZ E10 E11)                      MAIN
  25  CONTINUE                                                          MAIN
      WRITE (6,35)AMS,AME,H,WT,AM,DAC,TAC,XNZZ,E10,E11                  MAIN
 35   FORMAT(1H ,10X,2F8.3,4X,2F8.0,F7.3,5X,2F7.3,3X,3F4.0)             MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
C     ...                                                               MAIN
    7 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 14)                                       MAIN
  14  FORMAT(1H0,2X,6HRUN   2X,43H INT  H  END H  TYPE INT WT  END WT  MMAIN
     1ACH  5X,14H RANGE   TIME 3X,12HXNZZ E10 E11)                      MAIN
  24  CONTINUE                                                          MAIN
      WRITE (6,34)XQA1,XQAE,XQFP,XQW1,XQW2,AM,RN,TTR,XNZZ,E10,E11       MAIN
 34   FORMAT(1H ,10X,2F8.0,F4.0,2F8.0,F7.3,1X,2F10.3,1X,3F4.0)          MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
    8 CONTINUE                                                          MAIN
      IF(NL .NE. N)  WRITE(6, 18)                                       MAIN
  18  FORMAT(1H0,2X,6HGOGO  2X,43H INT  H  END H  TYPE INT WT  END WT  MMAIN
     1ACH  5X,14H RANGE   TIME 3X,12HXNZZ E10 E11)                      MAIN
      NL = N                                                            MAIN
      GO TO 24                                                          MAIN
    9 CONTINUE                                                          MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
   10 CONTINUE                                                          MAIN
      NL = N                                                            MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SACNS2                                                 MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG(264), CD    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(301), IA46X )                                  MAIN
      EQUIVALENCE (XNSEG(302), IA46Y )                                  MAIN
      EQUIVALENCE (XNSEG(303), IA47X )                                  MAIN
      EQUIVALENCE (XNSEG(304), IA47Y )                                  MAIN
      EQUIVALENCE (XNSEG(305), IA48X )                                  MAIN
      EQUIVALENCE (XNSEG(306), IA48Y )                                  MAIN
      EQUIVALENCE (XNSEG(286), INDA46)                                  MAIN
      EQUIVALENCE (XNSEG(287), INDA47)                                  MAIN
      EQUIVALENCE (XNSEG(288), INDA48)                                  MAIN
      EQUIVALENCE (XNSEG(289), INDA49)                                  MAIN
      EQUIVALENCE (XNSEG(290), INDA50)                                  MAIN
      EQUIVALENCE (XNSEG(291), INDA51)                                  MAIN
      EQUIVALENCE (XNSEG(292), INDA52)                                  MAIN
      EQUIVALENCE (XNSEG(293), INDA53)                                  MAIN
      EQUIVALENCE (XNSEG(294), INDA54)                                  MAIN
      EQUIVALENCE (XNSEG(295), INDA55)                                  MAIN
      EQUIVALENCE (XNSEG(296), INDA56)                                  MAIN
      EQUIVALENCE (XNSEG(297), INDA57)                                  MAIN
      EQUIVALENCE (XNSEG(298), INDA58)                                  MAIN
      EQUIVALENCE (XNSEG(299), INDA59)                                  MAIN
      EQUIVALENCE (XNSEG(300), INDA60)                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      EQUIVALENCE (XNSEG(702),CASA)                                     MAIN
      EQUIVALENCE  (XNSEG(349),IPXX)                                    MAIN
      REAL CDA(3), KEY(3)                                               MAIN
      EQUIVALENCE (CDA(1), CD1)                                         MAIN
      EQUIVALENCE (CDA(2), CD2)                                         MAIN
      EQUIVALENCE (CDA(3), CD3)                                         MAIN
      LOGICAL  IPXX(10)                                                 MAIN
      INTEGER LOCSAC(50)                                                MAIN
      INTEGER CASE                                                      MAIN
C                                                                       MAIN
      REAL K11,K12,K13                                                  MAIN
      REAL K21,K22,K23                                                  MAIN
      REAL K31,K32,K33                                                  MAIN
      CD1 = 0.0                                                         MAIN
      CD2 = 0.0                                                         MAIN
      CD3 = 0.0                                                         MAIN
C                                                                       MAIN
      IF(CASE .EQ. 2)  GO TO 200                                        MAIN
      IF(CASE .EQ. 3) GO TO 300                                         MAIN
C                                                                       MAIN
 100  CONTINUE                                                          MAIN
      CD01=0.0                                                          MAIN
      K11=0.0                                                           MAIN
      K21=0.0                                                           MAIN
      K31=0.0                                                           MAIN
      CLM1=0.0                                                          MAIN
      IF(INDA46 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(28),IA46X,IA46Y,0    ,0,H,AM,0,0,CD01)         MAIN
      IF (INDA49.NE.0)  CALL TLU  (AM,LOCSAC(31),K11)                   MAIN
      IF (INDA52.NE.0)  CALL TLU  (AM,LOCSAC(34),K21)                   MAIN
      IF (INDA55.NE.0)  CALL TLU  (AM,LOCSAC(37),K31)                   MAIN
      IF (INDA58.NE.0)  CALL TLU  (AM,LOCSAC(40),CLM1)                  MAIN
      CD=CD01+K11*CL**2+K21*(CL-CLM1)**2+K31*CL**3                      MAIN
      CD1 = CD                                                          MAIN
      IF(IPXX(9) ) WRITE(6,123)  CASE,INDA46,INDA49,INDA52,INDA55,      MAIN
     1       INDA58,AM,H,CD01,CL,CLM1,K11,K21,K31,CD                    MAIN
  123 FORMAT(1H ,1X,*SACNS2---CASE,I46,I49,I52,I55,I58,M,H,CD01,CL,CLM1,MAIN
     1K11,K21,K31,CD *,/1H ,6(1X,I2),F6.2,1X,F9.0,7(1X,F7.4) )          MAIN
      IF(CASE .EQ. 1)  GO TO 1002                                       MAIN
C                                                                       MAIN
 200  CONTINUE                                                          MAIN
      CD02=0.0                                                          MAIN
      K12=0.0                                                           MAIN
      K22=0.0                                                           MAIN
      K32=0.0                                                           MAIN
      CLM2=0.0                                                          MAIN
      IF(INDA47 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(29),IA47X,IA47Y,0    ,0,H,AM,0,0,CD02)         MAIN
      IF (INDA50.NE.0)  CALL TLU  (AM,LOCSAC(32),K12)                   MAIN
      IF (INDA53.NE.0)  CALL TLU  (AM,LOCSAC(35),K22)                   MAIN
      IF (INDA56.NE.0)  CALL TLU  (AM,LOCSAC(38),K32)                   MAIN
      IF (INDA59.NE.0)  CALL TLU  (AM,LOCSAC(41),CLM2)                  MAIN
      CD=CD02+K12*CL**2+K22+(CL-CLM2)**2+K32*CL**3                      MAIN
      CD2 = CD                                                          MAIN
      IF(CASE .EQ. 2)  GO TO 1002                                       MAIN
C                                                                       MAIN
 300  CONTINUE                                                          MAIN
      CD03=0.0                                                          MAIN
      K13=0.0                                                           MAIN
      K23=0.0                                                           MAIN
      K33=0.0                                                           MAIN
      CLM3=0.0                                                          MAIN
      IF(INDA48 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(30),IA48X,IA48Y,0    ,0,H,AM,0,0,CD03)         MAIN
      IF (INDA51.NE.0)  CALL TLU  (AM,LOCSAC(33),K13)                   MAIN
      IF (INDA54.NE.0)  CALL TLU  (AM,LOCSAC(36),K23)                   MAIN
      IF (INDA57.NE.0)  CALL TLU  (AM,LOCSAC(39),K33)                   MAIN
      IF (INDA60.NE.0)  CALL TLU  (AM,LOCSAC(42),CLM3)                  MAIN
      CD=CD03+K13*CL**2+K23*(CL-CLM3)**2+K33*CL**3                      MAIN
      CD3 = CD                                                          MAIN
      IF(CASE .EQ. 3)  GO TO 1002                                       MAIN
      IF(CASE .LE. 0)  GO TO 1000                                       MAIN
C     (CASE .GT. 3)    ....    SUM DRAG COMPONENTS                      MAIN
      CD = CD1 +CD2 +CD3                                                MAIN
      GO TO 1002                                                        MAIN
C                                                                       MAIN
 1000 CONTINUE                                                          MAIN
C     (CASE .EQ. 0)   ...   PICK LEAST DRAG VALUE THAT IS GREATER THAN 0MAIN
      CALL SHELL(CDA, KEY, 3)                                           MAIN
      DO 1001 I=1,3                                                     MAIN
      CD = CDA(I)                                                       MAIN
      IF(CD.EQ.CD1) CASA=1.                                             MAIN
      IF(CD.EQ.CD2) CASA=2.                                             MAIN
      IF(CD.EQ.CD3) CASA=3.                                             MAIN
      IF(CD .GT. 0.0)  RETURN                                           MAIN
 1001 CONTINUE                                                          MAIN
C                                                                       MAIN
 1002 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX21                                                  MAIN
      DIMENSION  A(8),B(8),C(8),V(2),X(8)                               MAIN
      INTEGER  QXICS,QXICF                                              MAIN
      COMMON /QXIC/ QXICS,QXICF                                         MAIN
      INTEGER  QXFLS,QXFS                                               MAIN
      COMMON /QXFILB/  QXFLS,QXFS(133)                                  MAIN
      COMMON /INXXA/ LA,A,LB,B,LC,C,LV,V,LX,X,Z(20)                     MAIN
      COMMON /INXXB/ REVCAL,NOEND,TERM(10)                              MAIN
      COMMON/COMSEG/ XNSEG(775)                                         MAIN
      EQUIVALENCE(XNSEG(756),IENFLG)                                    MAIN
      LOGICAL  NOEND                                                    MAIN
C     TERM(1) =   0. - NO SCALING                                       MAIN
C                 1. - TJ SCALING ONLY AT SEA LEVEL GIVEN CORRECTED     MAIN
C                      AIRFLOW                                          MAIN
C                 2. - TJ SCALING ONLY AT SEA LEVEL GIVEN THRUST        MAIN
C                      REQUIRED                                         MAIN
C                 3. - SAME AS 1. WITH RAMJET SCALING AT CRUISE GIVEN   MAIN
C                      CRUISE MACH, ALTITUDE, AND THRUST MARGIN.        MAIN
C                 4. - SAME AS 2. PLUS RAMJET SCALING AS IN 3.          MAIN
C                                                                       MAIN
C                 5. - RAMJET SCALING AS IN 3. ONLY                     MAIN
C     TERM(2) =  RAMJET CRUISE THRUST MARGIN                            MAIN
C     TERM(4) =   TJ  SEA LEVEL CORRECTED AIRFLOW FOR SCALING.          MAIN
C         OR  =   TJ  SEA LEVEL THRUST REQUIRED FOR SCALING             MAIN
C     TERM(3) =  SCALING MACH NO.                                       MAIN
C     TERM(5) =  SCALING TITUDE--SET NEGATIVE IF CURRENT WT USED TO     MAIN
C              COMPUTE ANGLE OF ATTACK.                                 MAIN
C     TERM(9) =   COMBINED ENGINE REF PRESSURE AND DEBUG PRINT INDICATORMAIN
C                   IF ABS VALUE .GT. 10.  THEN PERFORM DEBUG PRINT     MAIN
C                   IF VALUE .GT. 0.5 THEN WING LOWER SURFACE PRESSURE  MAIN
C                   IS USED FOR TURBOJET REF PRESSURE                   MAIN
C     TERM(6) AND TERM (10) ARE USED IN ALLUSE SUBROUTINE               MAIN
C     TERM(7) IS RESERVED FOR REVCAL FLAG IN ALLUSE                     MAIN
C     TERM(8) IS RESERVED FOR INX IN INXXX                              MAIN
      SGN = 1.0                                                         MAIN
      IENFLG=1                                                          MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1 )                                              MAIN
C     CALL QXIDEN ( 5,5HSCALE,JMP)                                      MAIN
      CALL QXIFRC ( 5,5HSCALE,JMP)                                      MAIN
      GO TO (20,110),JMP                                                MAIN
C     SCALING REQD                                                      MAIN
   20 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
C     CALL QXIDEN (5,5HTURBO,JMP )                                      MAIN
      CALL QXIFRC (5,5HTURBO,JMP )                                      MAIN
      IJMP = 1                                                          MAIN
      IWRD=4                                                            MAIN
      JWRD=1                                                            MAIN
      VALJ = 2.                                                         MAIN
      GO TO (40,50),JMP                                                 MAIN
C     SCALE TJET                                                        MAIN
   40 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1 )                                              MAIN
      CALL QXIFRC (7,7HTHRUST=,JMP)                                     MAIN
      GO TO (60,70),JMP                                                 MAIN
C     THRUST GIVEN                                                      MAIN
   60 CALL QXIFRC (1,1H,,JMP)                                           MAIN
      IF(TERM(1).GT.0.0) VALJ=4.0                                       MAIN
      GO TO (80,90),JMP                                                 MAIN
   90 WRITE(6,91)   C                                                   MAIN
   91 FORMAT(1H0,5X,*INPUT ERROR ON CARD --*,8A10,)                     MAIN
      GO TO 10                                                          MAIN
   80 CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV,V,Z)                                               MAIN
      CALL BCDDEC (Z,LV,TERM(IWRD))                                     MAIN
      TERM(JWRD) = VALJ                                                 MAIN
      GO TO 10                                                          MAIN
   70 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (8,8HAIRFLOW=,JMP)                                    MAIN
      GO TO (100,90),JMP                                                MAIN
C     AIRFLOW GIVEN                                                     MAIN
  100 IWRD = 4                                                          MAIN
      VALJ = 1.                                                         MAIN
      IJMP=1                                                            MAIN
      IF(TERM(1).GT.0. )  VALJ =3.                                      MAIN
      GO TO 60                                                          MAIN
   50 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
C     CALL QXIDEN (3,3HRAM,JMP)                                         MAIN
      CALL QXIFRC (3,3HRAM,JMP)                                         MAIN
      VALJ = 5.                                                         MAIN
      IF(TERM(1).EQ.1. )  VALJ = 3.                                     MAIN
      IF(TERM(1).EQ.2. )  VALJ = 4.                                     MAIN
      JWRD = 1                                                          MAIN
      IJMP=2                                                            MAIN
      GO TO (150,90),JMP                                                MAIN
  110 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HMACH=,JMP)                                        MAIN
      IWRD = 3                                                          MAIN
      IJMP  = 1                                                         MAIN
      JWRD = 0                                                          MAIN
      GO TO (120,30),JMP                                                MAIN
  120 CALL QXIFRC(1,1H,,JMP)                                            MAIN
      GO TO (130,90),JMP                                                MAIN
  130 CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET (LA,A,8,1HA)                                          MAIN
      CALL QXIGET (LV,V,2,1HV)                                          MAIN
      CALL QXIGET (LX,X,8,1HX)                                          MAIN
      CALL FILBCD (LV,V,Z )                                             MAIN
      CALL BCDDEC (Z,LV,TERM(IWRD))                                     MAIN
      IF(JWRD.EQ.0) GO TO 135                                           MAIN
      TERM(JWRD) = VALJ                                                 MAIN
 135  CONTINUE                                                          MAIN
      GO TO (140,10,10,160),IJMP                                        MAIN
  140 IWRD = 5                                                          MAIN
      JWRD=0                                                            MAIN
      IJMP = 2                                                          MAIN
      CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC ( 9,9HALTITUDE=,JMP)                                  MAIN
      GO TO (120,90),JMP                                                MAIN
  150 IWRD = 2                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HMARGIN=,JMP)                                      MAIN
C     THRUST MARGIN ASSUMED ZERO IF NOT GIVEN                           MAIN
      GO TO (120,10 ),JMP                                               MAIN
   30 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC (9,9HPRESSURE=,JMP)                                   MAIN
      JWRD = 0                                                          MAIN
      GO TO (155,170),JMP                                               MAIN
  155 CONTINUE                                                          MAIN
      IF( TERM(9) .LT. -1.0 )  TERM(9) = 100.                           MAIN
      IF( TERM(9) .GT. -1.0 )  TERM(9) = 1.0                            MAIN
      GO TO 10                                                          MAIN
  160 CALL ALLUSE                                                       MAIN
      IF(NOEND) GO TO 10                                                MAIN
      TERM(5) = TERM(5)*SGN                                             MAIN
  999 RETURN                                                            MAIN
  170 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HDEBUG,JMP)                                        MAIN
      GO TO (180,190),JMP                                               MAIN
  180 IF(TERM(9).GT. 0.1)  TERM(9) = 100.                               MAIN
      IF(TERM(9).LT. 0.1)  TERM(9) = -100.                              MAIN
      GO TO 10                                                          MAIN
  190 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,JMP)                                       MAIN
      IF(JMP.EQ.1)  SGN = -1.0                                          MAIN
      GO TO 160                                                         MAIN
      END                                                               MAIN
      SUBROUTINE FUELLD                                                 MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE INITIAL FUEL LOAD                    MAIN
C     ITS DISPOSITION, AND THE USABLE FUEL LOAD.                        MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 33), FF    )                                  MAIN
      EQUIVALENCE (XNSEG(225), FUELIN)                                  MAIN
      EQUIVALENCE (XNSEG(224), FUELTK)                                  MAIN
      EQUIVALENCE (XNSEG(223), FUELTO)                                  MAIN
      EQUIVALENCE (XNSEG(345),FUELT1 )                                  MAIN
      EQUIVALENCE (XNSEG(346),FUELT2 )                                  MAIN
      EQUIVALENCE (XNSEG(347),FUELT3 )                                  MAIN
      EQUIVALENCE (XNSEG(226), FUELUS)                                  MAIN
      EQUIVALENCE (XNSEG( 67), IPLF1 )                                  MAIN
      EQUIVALENCE (XNSEG( 68), IPLF2 )                                  MAIN
      EQUIVALENCE (XNSEG( 69), IPLF3 )                                  MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG( 35), OWE   )                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG(342), STWDRP)                                  MAIN
      EQUIVALENCE (XNSEG(227), TSWT  )                                  MAIN
      EQUIVALENCE (XNSEG(344), TSWDRP)                                  MAIN
      EQUIVALENCE (XNSEG( 58), WGTFT1)                                  MAIN
      EQUIVALENCE (XNSEG( 59), WGTFT2)                                  MAIN
      EQUIVALENCE (XNSEG( 60), WGTFT3)                                  MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG(228), WGTUF1)                                  MAIN
      EQUIVALENCE (XNSEG(229), WGTUF2)                                  MAIN
      EQUIVALENCE (XNSEG(230), WGTUF3)                                  MAIN
C                                                                       MAIN
      NTAPE6=6                                                          MAIN
      FUELTO=WGTO-OWE-PAYWT-STWDRP-TSWDRP                               MAIN
      FUELTK=0.0                                                        MAIN
      FUELT1=0.0                                                        MAIN
      FUELT2=0.0                                                        MAIN
      FUELT3=0.0                                                        MAIN
      WGTUF1=0.0                                                        MAIN
      WGTUF2=0.0                                                        MAIN
      WGTUF3=0.0                                                        MAIN
      FFP1 = 1.0 - FF                                                   MAIN
C                                                                       MAIN
      IF(IPLF1.NE.0) GO TO 100                                          MAIN
      FUELT1=WGTFT1*FLOAT(NTANK1)                                       MAIN
      WGTUF1 = WGTFT1*FFP1                                              MAIN
 100  CONTINUE                                                          MAIN
C                                                                       MAIN
      FUELTK=FUELTK+FUELT1                                              MAIN
      IF(IPLF2.NE.0) GO TO 200                                          MAIN
      FUELT2=WGTFT2*FLOAT(NTANK2)                                       MAIN
      WGTUF2 = WGTFT2*FFP1                                              MAIN
 200  CONTINUE                                                          MAIN
C                                                                       MAIN
      FUELTK=FUELTK+FUELT2                                              MAIN
      IF(IPLF3.NE.0) GO TO 300                                          MAIN
      FUELT3=WGTFT3*FLOAT(NTANK3)                                       MAIN
      WGTUF3 = WGTFT3*FFP1                                              MAIN
 300  CONTINUE                                                          MAIN
C                                                                       MAIN
      FUELTK=FUELTK+FUELT3                                              MAIN
      FUELIN=FUELTO-FUELTK                                              MAIN
      FUELUS = FUELTO*FFP1                                              MAIN
C                                                                       MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      I = 1                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK1,WGTFT1,WGTUF1,FUELT1                  MAIN
      I = 2                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK2,WGTFT2,WGTUF2,FUELT2                  MAIN
      I = 3                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK3,WGTFT3,WGTUF3,FUELT3                  MAIN
      WRITE(NTAPE6,9002) FUELIN,FUELTK,FUELTO,FF,FUELUS                 MAIN
C                                                                       MAIN
C     FORMATS                                                           MAIN
 9000 FORMAT(1H0,29H INITIAL FUEL LOAD STATEMENT )                      MAIN
 9001 FORMAT(1H0,13H TANK SYSTEM ,I1,19H NUMBER OF TANKS = ,I2,/        MAIN
     *       1H0,G12.5,25H POUNDS OF FUEL PER TANK ,/                   MAIN
     *       1H0,G12.5,32H POUNDS OF USABLE FUEL PER TANK ,/            MAIN
     *       1H0,G12.5,35H POUNDS TOTAL FUEL IN TANK SYSTEM. )          MAIN
 9002 FORMAT(1H0,G12.5,25H POUNDS OF INTERNAL FUEL ,/                   MAIN
     *       1H0,G12.5,21H POUNDS OF TANK FUEL ,/                       MAIN
     *       1H0,G12.5,19H POUNDS TOTAL FUEL ,/                         MAIN
     *       1H0, 12X, 15H FUEL FACTOR = ,G12.5,/                       MAIN
     *       1H0,G12.5,23H POUNDS OF USABLE FUEL )                      MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX7(TZ)                                             MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(94),H),(XNSEG(96),H0)                          MAIN
      EQUIVALENCE (XNSEG(98),PSET),(XNSEG(113),RN)                      MAIN
      EQUIVALENCE (XNSEG(119),TTR),(XNSEG(124),WT)                      MAIN
      EQUIVALENCE (XNSEG(141),XQFP),(XNSEG(231),WTKEP)                  MAIN
      EQUIVALENCE (XNSEG(234),RANGE),(XNSEG(237),ITZ)                   MAIN
      H0=H                                                              MAIN
      PSET = 0.0                                                        MAIN
      XQFP = 1.1                                                        MAIN
      WTKEP = WT                                                        MAIN
      RN = TZ(ITZ+4) - RANGE*(1.0 - TZ(ITZ + 3))                        MAIN
      NNGR = TZ(ITZ+6) + 1.1                                            MAIN
      GO TO (81,83,82,84),NNGR                                          MAIN
  83  TTR = -TTR                                                        MAIN
      RN = -RN                                                          MAIN
  81  RGCRT = 1.0                                                       MAIN
      TICRT = 1.0                                                       MAIN
      GO TO 87                                                          MAIN
  84  TTR = -TTR                                                        MAIN
      RN = -RN                                                          MAIN
  82  RGCRT = 0.0                                                       MAIN
      TICRT = 0.0                                                       MAIN
  87  CONTINUE                                                          MAIN
      CALL GOGO                                                         MAIN
      TTR = ABS(TTR)*TICRT                                              MAIN
      RN = ABS(RN)*RGCRT                                                MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XCEL                                                   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(123), W     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(157), YZA   )                                  MAIN
      EQUIVALENCE (XNSEG(160), ZX6   )                                  MAIN
      EQUIVALENCE (XNSEG(161), ZX7   )                                  MAIN
      EQUIVALENCE (XNSEG(173), A1    )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES CONSTANT ALTITUDE ACCELERATIONS AND DECELERATIMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C     CHANGE MADE TO HANDLE NEGATIVE XTT                                MAIN
      YZA = 1.0                                                         MAIN
      IF(AME .LT. AMS)  YZA = -1.0                                      MAIN
      DM=(AME-AMS)/XTT                                                  MAIN
      NXTT=ABS(XTT)                                                     MAIN
      XQBD=4.0                                                          MAIN
      W=WT                                                              MAIN
      TAC=0.0                                                           MAIN
      DAC=0.0                                                           MAIN
      CALL ATMOSD                                                       MAIN
      CALL CHECK                                                        MAIN
      IF(XNZZ .NE. 1.0)  GO TO 900                                      MAIN
      VXE=VX                                                            MAIN
      ACE=A1                                                            MAIN
      FFR=FN*SFC                                                        MAIN
      FFRE=FFR                                                          MAIN
C                                                                       MAIN
      DO 877 I=1,NXTT                                                   MAIN
      IF(ZX6.LT.0.01) GO TO 12                                          MAIN
      W=WT                                                              MAIN
      W=W-ZX7                                                           MAIN
      WT=W                                                              MAIN
      CALL CHECK                                                        MAIN
      FFRE=FFR                                                          MAIN
      ACE=A1                                                            MAIN
      VXE=VX                                                            MAIN
 12    AM=AM+DM                                                         MAIN
      CALL CHECK                                                        MAIN
      IF(XNZZ .NE. 1.0)  GO TO 900                                      MAIN
      VXS=VXE                                                           MAIN
      ACS=ACE                                                           MAIN
      FFRS=FFRE                                                         MAIN
      FFR=FN*SFC                                                        MAIN
      FFRE=FFR                                                          MAIN
      ACE=A1                                                            MAIN
      VXE=VX                                                            MAIN
      DTA=(VXE-VXS)/(1800.0*(ACE+ACS))                                  MAIN
      TAC=TAC+DTA                                                       MAIN
      DAC=(VXE+VXS)*.2965*DTA+DAC                                       MAIN
      DW = FFR*DTA                                                      MAIN
      W=W-DW                                                            MAIN
      WT = W                                                            MAIN
  877 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(ZX6.GT.0.01) WT=WT-ZX7                                         MAIN
C                                                                       MAIN
  900 CONTINUE                                                          MAIN
      IF(IPXX(6))  CALL OUTXXX(6)                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAXLFT                                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ALPTAB                                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CLMX                                                   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RUN                                                    MAIN
      COMMON /CCRUZ/PRFAC(25)                                           MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     1                PVEL(25), ENDPT(2)                                MAIN
      COMMON /CENDAT/ CFNET(25),CSFC(25)                                MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE  (XNSEG(191),VEL),(XNSEG(92),FN)                      MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 78), AVSFC )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(136), XQAE  )                                  MAIN
      EQUIVALENCE (XNSEG(137), XQA1  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(142), XQR1  )                                  MAIN
      EQUIVALENCE (XNSEG(143), XQR2  )                                  MAIN
      EQUIVALENCE (XNSEG(144), XQR3  )                                  MAIN
      EQUIVALENCE (XNSEG(145), XQT1  )                                  MAIN
      EQUIVALENCE (XNSEG(146), XQT2  )                                  MAIN
      EQUIVALENCE (XNSEG(147), XQT3  )                                  MAIN
      EQUIVALENCE (XNSEG(148), XQW1  )                                  MAIN
      EQUIVALENCE (XNSEG(149), XQW2  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(160), ZX6   )                                  MAIN
      EQUIVALENCE (XNSEG(161), ZX7   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(5),PR)                                         MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      INTEGER PSET                                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES CRUSES WHERE INDEPENDENT VARIAVLE IS WEIGHT   MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      SFCX=0.0                                                          MAIN
      RN=0.0                                                            MAIN
      TTR=0.0                                                           MAIN
      NXTT=XTT                                                          MAIN
      WIN=W1                                                            MAIN
      WEN=W2                                                            MAIN
      DWT=(WIN-WEN)/XTT                                                 MAIN
      PSET=0                                                            MAIN
      NFP=XQFP                                                          MAIN
      IF(KPATH.GT.0)  GO TO 50                                          MAIN
      KPATH = 1                                                         MAIN
      AMPATH(1) = AM                                                    MAIN
      HPATH(1) = H                                                      MAIN
      CRANGE(1) = 0.0                                                   MAIN
      CTIME(1) = 0.0                                                    MAIN
      CFUEL(1) = 0.0                                                    MAIN
      CUMWT(1) = W1                                                     MAIN
      PGAM7D(1) = 0.0                                                   MAIN
      PVEL(1) = VEL                                                     MAIN
      PRFAC(1) = RFAC                                                   MAIN
      CSFC(1) = SFC                                                     MAIN
      CFNET(1) = FN                                                     MAIN
   50 CONTINUE                                                          MAIN
      GOTO(1,2,3),NFP                                                   MAIN
  1   CONTINUE                                                          MAIN
      XQBD=2.0                                                          MAIN
      HST=H                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 10                                         MAIN
      SFCB=SFC                                                          MAIN
      RFB=RFAC                                                          MAIN
      WB=WT                                                             MAIN
      VM=VN                                                             MAIN
      DO5I=1,NXTT                                                       MAIN
      WA=WB                                                             MAIN
      IF(ZX6.LT.0.01)GOTO11                                             MAIN
      WA=WA-ZX7                                                         MAIN
      WT=WA                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 10                                         MAIN
      SFCB=SFC                                                          MAIN
      RFB=RFAC                                                          MAIN
      DWT=(WT-W2)/FLOAT(NXTT+1-I)                                       MAIN
 11   WT=WT-DWT                                                         MAIN
      DO 801 JJ=1,2                                                     MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .LT. 0.5) GO TO 802                                        MAIN
      WRITE(6,803)                                                      MAIN
 803  FORMAT(92H0*** ATTENTION *** CRUISE CLIMB PATH ADJUSTED TO MAINTAIMAIN
     1N THRUST AVAILABLE GREATER THAN DRAG)                             MAIN
 801  CLC=CLC*WT/WA                                                     MAIN
      GO TO 10                                                          MAIN
 802  CONTINUE                                                          MAIN
      SFCA=SFCB                                                         MAIN
      RFA=RFB                                                           MAIN
      SFCB=SFC                                                          MAIN
      RFB=RFAC                                                          MAIN
      WB=WT                                                             MAIN
      DDR=.5*(RFB+RFA)*ALOG(WA/WB)                                      MAIN
      RN=RN+DDR                                                         MAIN
      VBAR=.5*(VN+VM)                                                   MAIN
      VM=VN                                                             MAIN
      DTTR=DDR/VBAR                                                     MAIN
      TTR=TTR+DTTR                                                      MAIN
      SFC=(SFCA+SFCB)/2.0                                               MAIN
   5  SFCX=SFCX+SFC                                                     MAIN
      AVSFC=SFCX/XTT                                                    MAIN
  10  XQR1=RN                                                           MAIN
      XQT1=TTR                                                          MAIN
      XQA1=HST                                                          MAIN
      XQAE=H                                                            MAIN
      XQW1=W1                                                           MAIN
      XQW2=W2                                                           MAIN
      GOTO900                                                           MAIN
  2   CONTINUE                                                          MAIN
      CALLALTA                                                          MAIN
      QS=XQSW*1481.352*PR*AM**2                                         MAIN
      XQBD=1.0                                                          MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 8                                          MAIN
      SFCB=SFC                                                          MAIN
      WB=WT                                                             MAIN
      XHOLD=0.0                                                         MAIN
      FFB=1.0/FFR                                                       MAIN
      DO6I=1,NXTT                                                       MAIN
      WA=WB                                                             MAIN
      FFA=1.0/FFR                                                       MAIN
      IF(ZX6.LT.0.01)GO TO101                                           MAIN
      WA=WA-ZX7                                                         MAIN
      WT=WA                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 8                                          MAIN
      FFA=1.0/FFR                                                       MAIN
      DWT=(WT-W2)/FLOAT(NXTT+1-I)                                       MAIN
 101  WC=WA-0.5*DWT                                                     MAIN
      WT=WC                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 8                                          MAIN
      FFC=1.0/FFR                                                       MAIN
      IF(ZX6.LT.0.01)GO TO 102                                          MAIN
      WB=WC                                                             MAIN
      FFB=FFC                                                           MAIN
      XHOLD=ZX7                                                         MAIN
      WC=WA+0.5*DWT                                                     MAIN
      WT=WC                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 8                                          MAIN
      FFC=1.0/FFR                                                       MAIN
      GOTO103                                                           MAIN
 102  WB=WA-DWT                                                         MAIN
      WT=WB                                                             MAIN
      CALLCHECK                                                         MAIN
      IF(E10 .GT. 0.5) GO TO 8                                          MAIN
      FFB=1.0/FFR                                                       MAIN
 103  CALLXFIT2(WA,WB,WC,FFA,FFB,FFC,CC,BB,AA,XATYM,YM,XR,XRR)          MAIN
      RN=RN+VN*(WA-WB)*(WA*(AA/3.0*(WA+WB)+BB/2.0)+WB*((AA/3.0)*(       MAIN
     1WB)+BB/2.0)+CC)                                                   MAIN
      TTR=RN/VN                                                         MAIN
      IF(ABS(XHOLD) .LT.0.01)GOTO6                                      MAIN
      ZX7=XHOLD                                                         MAIN
      ZX6=1.0                                                           MAIN
 6    CONTINUE                                                          MAIN
      AVSFC=SFCX/XTT                                                    MAIN
    8 XQR2=RN                                                           MAIN
      XQT2=TTR                                                          MAIN
      XQA1=HST                                                          MAIN
      XQAE=H                                                            MAIN
      XQW1=W1                                                           MAIN
      XQW2=W2                                                           MAIN
      GOTO900                                                           MAIN
 3    XQBD=5.1                                                          MAIN
      CALLCHECK                                                         MAIN
      XQBD=3.1                                                          MAIN
      CALLCHECK                                                         MAIN
      SFCB=SFC                                                          MAIN
      WB=WT                                                             MAIN
      DO9I=1,NXTT                                                       MAIN
      WA=WB                                                             MAIN
      IF(ZX6.LT.0.01)GO TO 201                                          MAIN
      WA=WA-ZX7                                                         MAIN
      WT=WA                                                             MAIN
      CALLCHECK                                                         MAIN
      SFCB=SFC                                                          MAIN
      VM=VN                                                             MAIN
      DWT=(WT-W2)/FLOAT(NXTT+1-I)                                       MAIN
 201  WT=WT-DWT                                                         MAIN
      VM=VN                                                             MAIN
      SFCA=SFCB                                                         MAIN
      CALLCHECK                                                         MAIN
      SFCB=SFC                                                          MAIN
      WB=WT                                                             MAIN
      SFC=(SFCA+SFCB)*.5                                                MAIN
      DDR=2.0*(VM-VN)/SFC*CLCD                                          MAIN
      RN=RN+DDR                                                         MAIN
      DTTR=CLCD*ALOG(WA/WB)/SFC                                         MAIN
      SFCX=SFCX+SFC                                                     MAIN
   9  TTR=TTR+DTTR                                                      MAIN
      AVSFC=SFCX/XTT                                                    MAIN
      XQR3=RN                                                           MAIN
      XQT3=TTR                                                          MAIN
      XQA1=HST                                                          MAIN
      XQAE=H                                                            MAIN
      XQW1=W1                                                           MAIN
      XQW2=W2                                                           MAIN
  900 CONTINUE                                                          MAIN
      IF(IPXX(7))  CALL OUTXXX(7)                                       MAIN
      KPATH = KPATH + 1                                                 MAIN
      K = KPATH                                                         MAIN
      CSFC(K) = SFC                                                     MAIN
      CFNET(K) = FN                                                     MAIN
      AMPATH(K) = AM                                                    MAIN
      HPATH(K) = H                                                      MAIN
      CRANGE(K) = RN  + CRANGE(K-1)                                     MAIN
      CTIME(K) = TTR*60. + CTIME(K-1)                                   MAIN
      CFUEL(K) = CFUEL(K - 1) + W1 - W2                                 MAIN
      CUMWT(K) = W2                                                     MAIN
      GAM = (H - HPATH(K - 1))/( (RN - CRANGE(K - 1))*6076.)            MAIN
      PGAM7D(K) = 57.296 * ATAN(GAM)                                    MAIN
      PVEL(K) = VN                                                      MAIN
      PRFAC(K) = RFAC                                                   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX21(TZ)                                             MAIN
      REAL TZ(1)                                                        MAIN
      COMMON/COMSEG/  XNSEG(775)                                        MAIN
      EQUIVALENCE   (XNSEG(72),AMACH   ),(XNSEG(94),ALT    )            MAIN
      EQUIVALENCE   (XNSEG(735),IPN     ),(XNSEG(736),IDEBUG  )         MAIN
      EQUIVALENCE   (XNSEG(731),INSCAL ),(XNSEG(730),IEOP  )            MAIN
      EQUIVALENCE   (XNSEG(737),TJCAIR ),(XNSEG(320),NUMENG)            MAIN
      EQUIVALENCE   (XNSEG(237),KTZ    ),(XNSEG(85),DRT    )            MAIN
      EQUIVALENCE   (XNSEG(699),INDCLA )                                MAIN
      EQUIVALENCE  (XNSEG(751),FNFACT )                                 MAIN
      EQUIVALENCE   (XNSEG(124),WT),(XNSEG(79),CL)                      MAIN
      EQUIVALENCE   (XNSEG(109),QS),(XNSEG(183),Q)                      MAIN
      EQUIVALENCE   (XNSEG(83),CLMAX),(XNSEG(94),H)                     MAIN
      EQUIVALENCE   (XNSEG(583),SREF),(XNSEG(127),XQSW)                 MAIN
      EQUIVALENCE   (XNSEG(36),AREFF),(XNSEG(32),WGTO)                  MAIN
      EQUIVALENCE   (XNSEG(605),W0)                                     MAIN
      EQUIVALENCE (XNSEG(98),PSET)                                      MAIN
      EQUIVALENCE (XNSEG(97),PS )                                       MAIN
      INTEGER  PSSAVE,PSET                                              MAIN
      FNENG=FLOAT(NUMENG)                                               MAIN
      ITZ=KTZ-1                                                         MAIN
C     IPN = TZ(ITZ+3)                                                   MAIN
      PEXIT = TZ(ITZ + 9 )                                              MAIN
      IDEBUG = 0                                                        MAIN
      IPN = 0                                                           MAIN
      IF(PEXIT.GT.0.5)  IPN = 1                                         MAIN
      IF( ABS(PEXIT).GT.10. )  IDEBUG = 1                               MAIN
      INDSCL = TZ(ITZ + 1)                                              MAIN
      PSSAVE=PSET                                                       MAIN
      PSET = 0                                                          MAIN
      IF(INDSCL.EQ. 5 ) GO TO  10                                       MAIN
      IF(INDSCL.LE. 0 ) GO TO  999                                      MAIN
      AMSAV = AMACH                                                     MAIN
      IOPSAV = IEOP                                                     MAIN
      ALTSAV = ALT                                                      MAIN
      IEOP = 1                                                          MAIN
      INDSAV = INDCLA                                                   MAIN
      INDCLA = 0                                                        MAIN
      AMACH = 0.                                                        MAIN
      ALT = 0.                                                          MAIN
      INSCAL = 2                                                        MAIN
      IF( (INDSCL.EQ.2).OR.(INDSCL.EQ.4) )  INSCAL=1                    MAIN
      PS = TZ(ITZ + 4)                                                  MAIN
      TJCAIR = TZ(ITZ + 4)                                              MAIN
      IF(PS.LE.3.0) PS=PS*WT/FNENG                                      MAIN
      CALL ENDAT                                                        MAIN
      IF(IOPSAV.NE.1)  GO TO 5                                          MAIN
C     SIZE INLET FOR TURBOJET AIRFLOW REQUIREMENTS AT CRUISE MACH AND   MAIN
C     ALTITUDE.                                                         MAIN
      AMACH = TZ(ITZ+3)                                                 MAIN
      ALT = ABS(TZ(ITZ+5))                                              MAIN
      H = ALT                                                           MAIN
      CALL ATMOSD                                                       MAIN
      S = XQSW                                                          MAIN
      IF(S.LT.1.0)  S = SREF                                            MAIN
      IF(S.LT.1.0)  S = AREFF                                           MAIN
      QS = Q*S                                                          MAIN
      IF(TZ(ITZ+5).LT.0.0)  GO TO 6                                     MAIN
      IF(CLMAX.LT.0.001)  GO TO 6                                       MAIN
C     CL = CRUISE CL                                                    MAIN
      CL = CLMAX                                                        MAIN
      GO TO 7                                                           MAIN
    6 W=W0                                                              MAIN
      IF(W.LT.1.0)  W = WGTO                                            MAIN
      CL = 0.75*W/QS                                                    MAIN
      IF(TZ(ITZ+5).LT.0.0)  CL = WT/QS                                  MAIN
    7 CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      INSCAL = 5                                                        MAIN
      CALL ENDAT                                                        MAIN
    5 CONTINUE                                                          MAIN
      AMACH = AMSAV                                                     MAIN
      ALT = ALTSAV                                                      MAIN
      INDCLA = INDSAV                                                   MAIN
      IEOP = IOPSAV                                                     MAIN
   10 CONTINUE                                                          MAIN
      IF(INDSCL.LT.3) GO TO 999                                         MAIN
      INSCAL = 3                                                        MAIN
      IOPSAV = IEOP                                                     MAIN
      IEOP = 3                                                          MAIN
      FNFACT = 1. + TZ(ITZ + 2)                                         MAIN
      AMSAV = AMACH                                                     MAIN
      ALTSAV = ALT                                                      MAIN
      AMACH = TZ(ITZ+3)                                                 MAIN
      ALT = ABS(TZ(ITZ + 5))                                            MAIN
      H = ALT                                                           MAIN
      CALL ATMOSD                                                       MAIN
      S = XQSW                                                          MAIN
      IF (S.LT.1.0) S=SREF                                              MAIN
      IF (S.LT.1.0) S=AREFF                                             MAIN
      QS = Q*S                                                          MAIN
      IF(TZ(ITZ + 5).LT.0.0)  GO TO 20                                  MAIN
      IF( CLMAX.LT.0.001) GO TO 12                                      MAIN
C     CLMAX = MAX CRUISE CL                                             MAIN
      CL = CLMAX                                                        MAIN
      GO TO 15                                                          MAIN
C     SCALING WEIGHT (CRUISE CLMAX NOT GIVEN) FOR CRUISE ASSUMED        MAIN
C     EQUAL TO 0.75*TAKE-OFF WT                                         MAIN
   12 W = W0                                                            MAIN
      IF( W.LT.1.0) W=WGTO                                              MAIN
      CL = 0.75*W/QS                                                    MAIN
   15 CONTINUE                                                          MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      ALT = ALTSAV                                                      MAIN
      AMACH = AMSAV                                                     MAIN
      IEOP = IOPSAV                                                     MAIN
  999 WRITE (6,1000 )                                                   MAIN
 1000 FORMAT(1H0,5X,* ENGINE SCALING COMPLETED *, )                     MAIN
      PSET = PSSAVE                                                     MAIN
      INSCAL = 0                                                        MAIN
      RETURN                                                            MAIN
C     COMPUTE ALPHA FOR SCALING BASED ON CURRENT WEIGHT.                MAIN
   20 CL = WT/QS                                                        MAIN
      GO TO 15                                                          MAIN
      END                                                               MAIN
      SUBROUTINE CBFUEL(DEGTRN, TIME)                                   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      DATA PI /3.141592654/                                             MAIN
      CALL ATMOSD                                                       MAIN
      SPEED = AM*ASPEED                                                 MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
C     IF(CL .GT. CLMAX)  CL = CLMAX                                     MAIN
C     MODIFIED TO ELIMINATE CL MAX. LIMIT                               MAIN
C     THE ROUTINE NOW OUTPUTS THE REQUIRED CL.                          MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(DEGTRN .LE. 0.0)  RETURN                                       MAIN
      TIME = 0.0                                                        MAIN
      IF(GLEVEL .LE. 0.0)  RETURN                                       MAIN
      CLSTAR = CL                                                       MAIN
      FACTOR = (QS*CLSTAR)**2 -WT**2                                    MAIN
      FACTOR = 32.2*SQRT(FACTOR)                                        MAIN
      TURNR = WT*SPEED**2/FACTOR                                        MAIN
C     TIME TO TURN 180 DEG IN HOURS                                     MAIN
      TIMTRN = PI*TURNR/SPEED/3600.0                                    MAIN
      TIME = TIMTRN*DEGTRN/180.0                                        MAIN
      WRITE(6,1000) CL,GLEVEL,DEGTRN,TIME                               MAIN
 1000 FORMAT(1H0,28H REQUIRED LIFT COEFFICIENT =,G13.5,                 MAIN
     1          /20H TO PULL A G LEVEL =,G13.5,                         MAIN
     2          /26H DEGREES TURN CALLED FOR =,G13.5,                   MAIN
     3          /31H TIME FOR THE TURN CALLED FOR =,G13.5)              MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ENGINS(IOP,TSETTJ,TSETRJ,FAVTOT,WFTOT,LSPILL,INTSET    MAIN
     *,FNREQ,ALPHA,IPFENG)                                              MAIN
C     * * * * *                                                         MAIN
C     THIS SUBROUTINE COMPUTES NET THRUST AND AIR AND FUEL FLOW         MAIN
C     PARAMETERS FOR A SINGLE TURBOJET ENGINE, A SINGLE RAMJET ENGINE,  MAIN
C     OR A SINGLE TURBO-RAMJET ENGINE COMBINATION.                      MAIN
C     *****  CALLING ARGUMENTS  *****                                   MAIN
C     ** INPUTS **                                                      MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE   (XNSEG(711),INDE01 ),(XNSEG(712),INDE02 )           MAIN
      EQUIVALENCE   (XNSEG(713),INDE03 ),(XNSEG(714),INDE04 )           MAIN
      EQUIVALENCE   (XNSEG(715),INDE05 ),(XNSEG(716),INDE06 )           MAIN
      EQUIVALENCE   (XNSEG(717),INDE07 ),(XNSEG(718),INDE08 )           MAIN
      EQUIVALENCE   (XNSEG(719),INDE09 ),(XNSEG(720),INDE10 )           MAIN
      EQUIVALENCE   (XNSEG(721),NPT3   ),(XNSEG(722),NPT4   )           MAIN
      EQUIVALENCE   (XNSEG(723),NPT5   ),(XNSEG(724),NPTX6  )           MAIN
      EQUIVALENCE   (XNSEG(725),NPTZ6  ),(XNSEG(726),NPT7   )           MAIN
      EQUIVALENCE   (XNSEG(727),NPT8   ),(XNSEG(728),NPT9   )           MAIN
      EQUIVALENCE   (XNSEG(729),NPT10  )                                MAIN
      EQUIVALENCE   (XNSEG(731),INSCAL ),(XNSEG(732),AINLET )           MAIN
      EQUIVALENCE   (XNSEG(733),DELW   ),(XNSEG(734),DELIN  )           MAIN
      EQUIVALENCE   (XNSEG(735),IPN     ),(XNSEG(736),IDEBUG  )         MAIN
      EQUIVALENCE   (XNSEG(737),TJCAIR ),(XNSEG(738),LOCENG(1))         MAIN
      EQUIVALENCE   (XNSEG(72),AMACH   ),(XNSEG(94),ALT     )           MAIN
      EQUIVALENCE   (XNSEG(751),FNFACT )                                MAIN
      EQUIVALENCE  ( XNSEG(124),WT )                                    MAIN
      EQUIVALENCE  (XNSEG(763),IPDENG)                                  MAIN
      EQUIVALENCE  (XNSEG(766),TJFACT)                                  MAIN
C     AMACH   -  FREESTREAM MACH NO.                                    MAIN
C     ALT     -  ALTITUDE (FT)                                          MAIN
C     IOP     -  ENGINE OPTION (SEE BELOW)                              MAIN
C        IOP = 1    TURBOJET ONLY                                       MAIN
C        IOP = 2    TURBO-RAMJET COMBINATION                            MAIN
C        IOP = 3    RAMJET ONLY                                         MAIN
C        IOP = 4                                                        MAIN
C     AINLET  -  ENGINE INLET AREA (FT**2)                              MAIN
C     ALPHA   -  ANGLE OF ATTACK (DEG)                                  MAIN
C     DELW    ANGLE OF WING LOWER SURFACE W.R.T. VEHICLE REF. LINE      MAIN
C                (DEG)                                                  MAIN
C     DELIN   -  ENGINE INLET WEDGE ANGLE (DEG)                         MAIN
C     FNREQ   -  TOTAL NET THRUST REQUIRED (LB) IN FREESTREAM DIRECTION MAIN
C     INSCAL  -  SCALING FLAG                                           MAIN
C           0 = NO SCALING                                              MAIN
C           1 = TJ SCALING AT SEA LEVEL GIVEN BASE ENGINE AND NET TJ    MAIN
C                THRUST REQUIRED (CALL WITH MACH=ALT=0.)                MAIN
C           2 = TJ SCALING AT SEA LEVEL GIVEN CORRECTED AIRFLOW         MAIN
C                (CALL WITH MACH=ALT=0.)                                MAIN
C           3 = RJ SCALING, GIVEN NET THRUST MARGIN DETERMINE INLET     MAIN
C                AREA                                                   MAIN
C           4 = NO RJ SCALING, INLET AREA GIVEN.                        MAIN
C           5 = SIZE INLET TO PROVIDE MAX TJ AIRFLOW REQUIREMENTS AT    MAIN
C               CRUISE ALTITUDE AND MACH.                               MAIN
C     IPN     -  REF PRESSURE OPTION FLAG                               MAIN
C           0 = REF PRESSURE = FREESTREAM STATIC                        MAIN
C           1 = REF PRESSURE = EXIT PRESSURE                            MAIN
C     PEXIT   -  EXIT PRESSURE                                          MAIN
C     TJCAIR  -  SPECIFIED CORRECTED TJ AIRFLOW FOR SCALING PURPOSES    MAIN
C     FNFACT  -  FACTOR WHICH MULTIPLIES NET THRUST TO PROVIDE DESIRED  MAIN
C                THRUST MARGIN FOR RAMJET SCALING                       MAIN
C     INTSET  -  THROTTLE SETTING OPTION                                MAIN
C        INTSET = -1  SPECIFIED (USUALLY MINIMUM) THROTTLE SETTING.     MAIN
C                     THE TURBOJET TOTAL THRUST = FGMAX*TSETTJ          MAIN
C                     RAMJET AIRFLOW = WARMAX*TSETRJ OR THE AIRFLOW     MAIN
C                     SPILLED BY THE TURBOJET, WHICHEVER IS LESS.       MAIN
C                     BOTH THE TJ AND RJ THROTTLE SETTINGS MUST BE      MAIN
C                     PRESPECIFIED FOR THIS OPTION.                     MAIN
C        INTSET =  0  NET THRUST PROVIDED IS NET THRUST REQUIRED (FREQ),MAIN
C                     IF POSSIBLE, MAX POSSIBLE OTHERWISE               MAIN
C        INTSET =  1  MAX THROTTLE OPTION.  THRUST PROVIDED IS MAX      MAIN
C                     POSSIBLE.                                         MAIN
C     ** OUTPUTS **                                                     MAIN
C     TSETTJ  -  TURBOJET THROTTLE SETTING                              MAIN
C     TSETRJ  -  RAMJET THROTTLE SETTING                                MAIN
C     FAVTJ   -  TURBOJET NET THRUST (LB)                               MAIN
C     FAVRAM  -  RAMJET NET THRUST (LB)                                 MAIN
C     FAVTOT  -  TOTAL NET THRUST (LB)                                  MAIN
C     WFTJ    -  TURBOJET FUEL FLOW RATE (LB/SEC)                       MAIN
C     WFRAM   -  RAMJET FUEL FLOW RATE (LB/SEC)                         MAIN
C     WFTOT   -  TOTAL FUEL FLOW RATE (LB/SEC)                          MAIN
C     WATJ    -  TJ AIRFLOW RATE SCALED FOR ALT AND MACH (LB/SEC)       MAIN
C     SFCOUT  -  TJ SPECIFIC FUEL CONSUMPTION ((LB FUEL/LB THRUST)/HOUR)MAIN
C     WARAM   -  RJ AIRFLOW RATE (LB/SEC)                               MAIN
C     DSPILL  -  SPILLAGE DRAG (LB)                                     MAIN
C     LSPILL  -  SPILLAGE LIFT (LB)                                     MAIN
C     DRAM    -  TJ RAM DRAG (LB)                                       MAIN
C                                                                       MAIN
      REAL  ISPR,M1,M2,LSPILL,M0TAB,LIFT,LINLET,M0                      MAIN
      DIMENSION  TEMPTB(160),ENTTAB(160),PRESTB(160),M0TAB(25)          MAIN
      DIMENSION  DELMXT(50),MBEFT(50)                                   MAIN
      DIMENSION  PT0TAB(300),TT0TAB(300),ALT0T(20)                      MAIN
      DIMENSION  LOCENG(10)                                             MAIN
C     UNITS ARE LB, FT, SEC, ANGULAR DEGREES, DEGREES RANKINE           MAIN
C     ENGINE DATA TABLES.                                               MAIN
C     TABLE 3 - INLET CAP AREA SCHEDULE  ( ACAP/AINLET VS  M0 )         MAIN
C     TABLE 4 - TJ PRESS RECOVERY SCHEDULE ( PT3/PT1 VS. M1 )           MAIN
C     TABLE 5 - TJ CORRECTED AIRFLOW SCHEDULE ( CORR AIRFLOW VS. TT1)   MAIN
C     TABLE 6 - TJ GROSS THRUST SCHEDULE ( FG/WA VS. TT1 AND            MAIN
C     LOG10(PT3/PT1).  TT1 IS X, LOG IS Z.  VARY X FASTER WHEN SETTING  MAIN
C     UP DATA FOR Y ARRAY (FG/WA).                                      MAIN
C     TABLE 7 - TJ FUEL/AIR RATIO SCHEDULE ( WF/WA VS. TT1 )            MAIN
C     TABLE 8 - TJ SFC RATIO VS. THROTTLE SETTING ( SFC/SFCMAX VS. TSET)MAIN
C     TABLE 9 - RAMJET ISP AND  FUEL/AIR RATIO SCHEDULES. ( ISP AND PHI MAIN
C               VS. M0 )   RJ WF/WA  = .0292*PHI                        MAIN
C     TABLE 10 - RJ MAX AIRFLOW SCHEDULE  ( WAMAX/WA FULL CAPTURE VS.   MAIN
C                TT2 )                                                  MAIN
      DATA   INDPTJ,INDPRJ   /0,0/                                      MAIN
      DATA  GAM,ITRMAX / 1.4,10 /                                       MAIN
      DATA NENTHL/154/,(TEMPTB(I),I=1,154   )/385.,390.,                MAIN
     1395.,400.,405.,410.,415.,420.,425.,430.,435.,440.,445.,450.,455., MAIN
     2460.,465.,470.,475.,480.,485.,490.,495.,500.,505.,510.,515.,520., MAIN
     3525.,530.,535.,540.,545.,550.,555.,560.,565.,570.,575.,580.,585., MAIN
     4590.,595.,600.,610.,620.,630.,640.,650.,660.,670.,680.,690.,700., MAIN
     5710.,720.,730.,740.,750.,760.,770.,780.,790.,800.,810.,820.,830., MAIN
     6840.,850.,860.,870.,880.,890.,900.,910.,920.,930.,940.,950.,960., MAIN
     7970.,980.,990.,1000.,1010.,1020.,1030.,1040.,1050.,1060.,1070.,   MAIN
     81080.,1090.,1100.,1110.,1120.,1130.,1140.,1150.,1170.,1190.,      MAIN
     91210.,1230.,1250.,1270.,1290.,1310.,1330.,1350.,1370.,1390.,      MAIN
     11410.,1430.,1450.,1470.,1490.,1510.,1530.,1550.,1570.,1590.,      MAIN
     21610.,1630.,1650.,1670.,1690.,1710.,1730.,1750.,1770.,1790.,      MAIN
     31810.,1830.,1850.,1870.,1890.,1910.,1930.,1950.,1970.,1990.,      MAIN
     42010.,2030.,2050.,2070.,2090.,2110.,2130.,2150.,2170.,2190.,      MAIN
     52210.,2230.,2250./                                                MAIN
      DATA(ENTTAB(I),I=1,154   )/91.95,93.13,94.33,95.53,               MAIN
     196.73,97.93,99.13,100.32,101.52,102.71,103.91,105.11,106.30,107.50MAIN
     2,108.70,109.90,111.10,112.30,113.50,114.69,115.89,117.08,118.28,  MAIN
     3119.48,120.68,121.87,123.07,124.27,125.47,126.66,127.86,          MAIN
     4129.06,130.26,131.46,132.66,133.86,135.06,136.26,137.47,          MAIN
     5138.66,139.86,141.06,142.26,143.47,145.88,148.28,150.68,          MAIN
     6153.09,155.50,157.92,160.33,162.73,165.15,167.56,169.98,          MAIN
     7172.39,174.82,177.23,179.66,182.08,184.51,186.94,189.38,          MAIN
     8191.81,194.25,196.69,199.12,201.56,204.01,206.46,208.90,          MAIN
     9211.35,213.80,216.26,218.72,221.18,223.64,226.11,228.58,          MAIN
     1231.06,233.53,236.02,238.50,240.98,243.48,245.97,248.45,          MAIN
     2250.95,253.45,255.96,258.47,260.97,263.48,265.99,268.52,          MAIN
     3271.03,273.56,276.08,278.61,283.68,288.76,293.86,298.96,          MAIN
     4304.08,309.22,314.36,319.53,324.69,329.88,335.09,340.29,          MAIN
     5345.52,350.75,356.00,361.27,366.53,371.82,377.11,382.42,          MAIN
     6387.74,393.07,398.42,403.77,409.13,414.51,419.89,425.29,          MAIN
     7430.69,436.12,441.55,446.99,452.44,457.90,463.37,468.86,          MAIN
     8474.35,479.85,485.36,490.88,496.40,501.94,507.49,513.04,          MAIN
     9518.61,524.18,529.75,535.35,540.94,546.54,552.16,557.78,          MAIN
     A563.41,569.04,574.69/                                             MAIN
      DATA (PRESTB(I),I=1,154   )/.4251,.4447,.4649,.4858,              MAIN
     1.5073,.5295,.5524,.5760,.6003,.6253,.6510,.6776,.7048,            MAIN
     2.7329,.7617,.7913,.8218,.8531,.8852,.9182,.9521,.9868,            MAIN
     31.0224,1.0590,1.0965,1.1349,1.1743,1.2147,1.2560,1.2983,          MAIN
     41.3416,1.3860,1.4315,1.4779,1.5255,1.5742,1.6240,1.6748,          MAIN
     51.7269,1.7800,1.8345,1.8899,1.9467,2.005,2.124,2.249,             MAIN
     62.379,2.514,2.655,2.801,2.953,3.111,3.276,3.446,3.623,            MAIN
     73.806,3.996,4.193,4.396,4.607,4.826,5.051,5.285,5.526,            MAIN
     85.775,6.033,6.299,6.573,6.856,7.149,7.450,7.761,8.081,            MAIN
     98.411,8.752,9.102,9.463,9.834,10.216,10.610,11.014,11.430,        MAIN
     111.858,12.298,12.751,13.215,13.692,14.182,14.686,                 MAIN
     215.203,15.734,16.278,16.838,17.413,18.000,18.604,                 MAIN
     319.223,19.858,20.51,21.86,23.28,24.76,26.32,                      MAIN
     427.96,29.67,31.46,33.34,35.30,37.35,39.49,41.73,                  MAIN
     544.06,46.49,49.03,51.68,54.43,57.30,60.29,63.40,                  MAIN
     666.63,70.00,73.49,77.12,80.89,84.80,88.87,93.08,                  MAIN
     797.45,101.98,106.67,111.54,116.57,121.79,127.18,                  MAIN
     8132.77,138.55,144.53,150.70,157.10,163.69,170.50,                 MAIN
     9177.55,184.81,192.31,200.06,208.06,216.3,224.8,                   MAIN
     A233.5,242.6,251.9,261.4,271.3,281.4/                              MAIN
      DATA NM0TAB/19/,(M0TAB(I),I=1,19    )/3.5,3.75,4.0,4.25,          MAIN
     14.5,4.75,5.0,5.25,5.5,5.75,6.0,6.25,6.5,6.75,7.0,7.25,            MAIN
     27.5,7.75,20.00/,NALT/15/,(ALT0T(I),I=1,15  )/65000.,              MAIN
     370000.,75000.,80000.,85000.,90000.,95000.,100000.,                MAIN
     4105000.,110000.,115000.,120000.,130000.,140000.,150000./          MAIN
      DATA NPT0/285/,(PT0TAB(I),I=1,190)/4.2,6.1,8.6,11.9,16.4,22.7,    MAIN
     131.4,42.9,57.9,77.2,100.5,130.5,166.5,216.0,279.5,357.5,451.5,    MAIN
     2568.0,720.0,3.4,4.9,7.0,9.8,13.6,18.9,25.7,34.3,45.6,60.7,        MAIN
     380.8,106.0,139.0,180.5,233.5,300.5,377.0,468.0,600.0,             MAIN
     42.8,3.9,5.7,7.9,10.9,14.8,19.9,26.7,35.8,47.7,63.5,84.0,          MAIN
     5110.0,143.0,187.5,241.0,306.0,385.5,482.0,2.2,3.1,4.2,            MAIN
     66.1,8.4,11.4,15.4,20.6,27.9,38.3,51.3,67.5,87.5,113.5,            MAIN
     7149.5,189.0,241.0,309.5,388.0,1.8,2.4,3.4,4.8,6.7,9.4,            MAIN
     812.7,17.0,22.7,30.2,40.1,53.5,69.5,90.5,117.0,151.0,              MAIN
     9192.5,247.0,313.0,1.4,1.8,2.6,3.7,5.2,7.2,9.8,13.2,17.9,          MAIN
     124.2,32.5,42.8,55.2,72.0,93.0,120.5,156.0,199.0,                  MAIN
     2253.0,1.1,1.6,2.2,3.1,4.3,5.9,7.9,10.8,14.4,19.4,25.7,            MAIN
     334.0,44.7,58.3,74.7,95.5,123.5,159.5,202.5,.8,1.2,1.7,            MAIN
     42.4,3.3,4.4,5.9,8.3,11.4,15.6,20.8,27.5,35.8,47.0,                MAIN
     561.0,79.0,101.3,129.0,160.5,.67,.75,1.3,1.9,2.8,3.8,4.8,          MAIN
     66.6,9.1,12.4,16.6,21.9,28.4,36.7,48.3,63.5,81.5,103.5,131.0,      MAIN
     7.541,.602,1.05,1.55,2.1,2.85,3.95,5.5,7.6,10.2,13.5,17.8,23.2,    MAIN
     830.6,40.0,50.7,64.5,82.5,103.5/                                   MAIN
      DATA(PT0TAB(I),I=191,285)/.431,.4797,.91,1.29,1.73,2.31,          MAIN
     13.18,4.38,5.93,7.95,10.9,14.5,18.9,24.5,32.2,41.5,53.3,           MAIN
     268.2,85.7,.3572,.3945,.64,.92,1.35,1.92,2.68,3.7,4.98,6.55,8.65,  MAIN
     311.5,15.3,19.8,25.9,33.7,43.8,55.8,71.0,0.,0.,.485,.675,          MAIN
     4.95,1.3,1.78,2.44,3.36,4.4,6.0,7.95,10.45,13.6,17.9,              MAIN
     522.8,29.5,37.8,46.55,0.,0.,.325,.455,.62,.86,1.195,1.635,         MAIN
     62.2,2.9,3.96,5.3,6.7,8.8,11.8,15.7,20.5,26.0,32.31,0.,0.,         MAIN
     7.212,.298,.410,.580,.8,1.095,1.52,2.0,2.7,3.7,4.9,6.5,            MAIN
     88.45,10.9,14.0,18.51,23.68/                                       MAIN
      DATA (TT0TAB(I),I=1,152)/1320.,1445.,1575.,1710.,1845.,           MAIN
     11995.,2150.,2315.,2490.,2665.,2860.,3055.,3250.,3450.,            MAIN
     23645.,3840.,4035.,4235.,4435.,1325.,1458.,1595.,1740.,            MAIN
     31890.,2045.,2205.,2375.,2545.,2725.,2915.,3100.,3295.,            MAIN
     43490.,3690.,3880.,4080.,4280.,4475.,1340.,1475.,1615.,            MAIN
     51755.,1900.,2055.,2215.,2380.,2555.,2730.,2920.,3110.,            MAIN
     63300.,3500.,3700.,3905.,4105.,4320.,4530.,1345.,1480.,            MAIN
     71620.,1765.,1915.,2080.,2240.,2410.,2590.,2770.,2955.,            MAIN
     83150.,3340.,3535.,3735.,3940.,4140.,4355.,4555.,1350.,            MAIN
     91485.,1625.,1775.,1930.,2090.,2250.,2415.,2595.,2775.,            MAIN
     12965.,3160.,3360.,3570.,3780.,3980.,4190.,4395.,4600.,            MAIN
     21360.,1495.,1635.,1785.,1935.,2095.,2265.,2440.,2620.,            MAIN
     32810.,3000.,3195.,3390.,3590.,3790.,4000.,4205.,4410.,            MAIN
     44620.,1365.,1500.,1640.,1790.,1945.,2105.,2270.,2450.,            MAIN
     52630.,2820.,3010.,3205.,3395.,3600.,3810.,4020.,4235.,            MAIN
     64445.,4655.,1375.,1515.,1655.,1805.,1955.,2120.,2285.,            MAIN
     72460.,2640.,2835.,3025.,3225.,3420.,3625.,3835.,4045.,            MAIN
     84260.,4480.,4700./                                                MAIN
      DATA (TT0TAB(I),I=153,285 )/1390.,1530.,1665.,1815.,              MAIN
     11965.,2130.,2295.,2465.,2645.,2840.,3035.,3240.,3445.,3655.,      MAIN
     23865.,4080.,4295.,4510.,4730.,1410.,1545.,1685.,1840.,1995.,      MAIN
     32165.,2340.,2515.,2700.,2895.,3090.,3290.,3495.,3705.,3915.,      MAIN
     44125.,4340.,4565.,4785.,1440.,1570.,1710.,1865.,2025.,2190.,      MAIN
     52365.,2540.,2730.,2925.,3130.,3340.,3550.,3765.,3980.,4200.,      MAIN
     64415.,4635.,4855.,1450.,1585.,1735.,1895.,2060.,2235.,2415.,      MAIN
     72600.,2795.,2990.,3185.,3390.,3600.,3815.,4030.,4255.,4480.,      MAIN
     84705.,4935.,1500.,1645.,1795.,1960.,2130.,2310.,2490.,2680.,      MAIN
     92875.,3075.,3280.,3495.,3705.,3925.,4145.,4375.,4600.,4830.,      MAIN
     15075.,1545.,1700.,1860.,2025.,2200.,2380.,2565.,2760.,2960.,      MAIN
     23170.,3380.,3595.,3815.,4040.,4265.,4500.,4730.,4960.,5200.,      MAIN
     31595.,1750.,1915.,2080.,2260.,2445.,2635.,2840.,3040.,3260.,      MAIN
     43480.,3695.,3920.,4150.,4380.,4615.,4855.,5090.,5335./            MAIN
      DATA NDELMX/39/,(MBEFT(I),I=1,39    )/1.0,1.05,1.1,               MAIN
     11.15,1.2,1.25,1.3,1.35,1.4,1.45,1.5,1.55,1.6,1.65,1.7,            MAIN
     21.75,1.8,1.85,1.9,1.95,2.0,2.05,2.1,2.15,2.2,2.25,2.3,            MAIN
     32.35,2.4,2.45,2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2,20.0/,              MAIN
     4(DELMXT(I),I=1,39    )/0.0,.558,1.515,2.684,3.944,                MAIN
     55.286,6.662,8.048,9.427,10.785,12.113,13.403,14.652,              MAIN
     615.855,17.012,18.121,19.183,20.198,21.168,22.091,22.973,          MAIN
     723.813,24.614,25.376,26.103,26.794,27.454,28.082,28.682,          MAIN
     829.253,29.798,30.814,31.740,32.587,33.363,34.073,34.727,          MAIN
     935.327,100.0/                                                     MAIN
      DATA  INSMAX /10/                                                 MAIN
C     INITIALIZE                                                        MAIN
      IF(IPFENG.NE.0 )  GO TO 1100                                      MAIN
      M0 = AMACH                                                        MAIN
      FREQ = FNREQ                                                      MAIN
      IF(INSCAL.EQ.3)  FREQ = FNREQ*FNFACT                              MAIN
      ITERIN = 0                                                        MAIN
    1 CONTINUE                                                          MAIN
      SFCOUT=0.                                                         MAIN
      DSPILL=0.                                                         MAIN
      IF(INTSET.EQ.0)  GO TO 2                                          MAIN
      FREQ = 0.                                                         MAIN
    2 IF(INTSET.NE.0)  GO TO 3                                          MAIN
      TSETTJ = 0.                                                       MAIN
      TSETRJ = 0.                                                       MAIN
    3 CONTINUE                                                          MAIN
      LSPILL=0.                                                         MAIN
      SFC = 0.                                                          MAIN
      ITRTJ = 0                                                         MAIN
      ITRRJ = 0                                                         MAIN
      DRAM = 0.                                                         MAIN
      FTOTRJ = 0.                                                       MAIN
      FTOTTJ = 0.                                                       MAIN
      FAVTJ = 0.                                                        MAIN
      FAVRAM = 0.                                                       MAIN
      FAVTOT = 0.                                                       MAIN
      WFTJ = 0.                                                         MAIN
      WFRAM = 0.                                                        MAIN
      WFTOT = 0.                                                        MAIN
      WATJ = 0.                                                         MAIN
      WARAM = 0.                                                        MAIN
      WATOT = 0.                                                        MAIN
      WASRJ = 0.                                                        MAIN
      WARMAX = 0.                                                       MAIN
      PTSTAR = 0.                                                       MAIN
      FGOVWA = 0.                                                       MAIN
      ISPR = 0.                                                         MAIN
      CALL ATMS62 (ALT,T0,P0,RHO0,A0,ANU0,DTDH)                         MAIN
C     DETERMINE  TOTAL TEMP AND PRESSURE                                MAIN
      IF(IOP.GT.2)  GO TO 10                                            MAIN
      IF( (AMACH.LT. 3.5) .OR. (ALT.LT. 65000.) ) GO TO 10              MAIN
      CALL DISCOT (AMACH,ALT,M0TAB(1),PT0TAB(1),ALT0T(1), 111,NPT0,     MAIN
     *NALT,PTSTAR,IERROR )                                              MAIN
      IF(IERROR.EQ.0)  GO TO 5                                          MAIN
      WRITE(6,6)                                                        MAIN
    6 FORMAT(1H0,5X,57H** 2-D TABLE LOOKUP ERROR FOR PTSTAR IN ENGINS SUMAIN
     *BROUTINE,)                                                        MAIN
      GO TO 999                                                         MAIN
    5 CONTINUE                                                          MAIN
      PT0 = 2116.22 * PTSTAR                                            MAIN
      NTT0 = NPT0                                                       MAIN
      CALL DISCOT ( AMACH,ALT,M0TAB(1),TT0TAB(1),ALT0T(1), 111,NTT0,    MAIN
     *NALT,TT0,IERROR )                                                 MAIN
      IF(IERROR.EQ.0)  GO TO 20                                         MAIN
      WRITE(6,7)                                                        MAIN
    7 FORMAT(1H0,5X,54H** 2-D TABLE LOOKUP ERROR FOR TT0 IN ENGINS SUBROMAIN
     *UTINE,)                                                           MAIN
      GO TO 999                                                         MAIN
   10 CONTINUE                                                          MAIN
      CALL FTLUP ( T0, H, 1, NENTHL, TEMPTB(1),ENTTAB(1) )              MAIN
      DELH =  ( AMACH * A0 )**2 / 50073.2                               MAIN
      HTOT = H + DELH                                                   MAIN
      CALL FTLUP ( T0, PR, 1, NENTHL, TEMPTB(1), PRESTB(1) )            MAIN
      CALL FTLUP ( HTOT , TT0   , 1,NENTHL,ENTTAB(1),TEMPTB(1) )        MAIN
      CALL FTLUP ( HTOT , PRT0  , 1,NENTHL,ENTTAB(1),PRESTB(1) )        MAIN
      PT0 =  PRT0 * P0 / PR                                             MAIN
   20 CONTINUE                                                          MAIN
C     COMPUTE CONDITIONS AFT OF WING SHOCK  (STATION 1 ).               MAIN
      ANG = ALPHA + DELW                                                MAIN
      TANIN = TAN(DELIN/57.2958)                                        MAIN
      COSG = COS(ANG/57.2958)                                           MAIN
      SING = SIN(ANG/57.2958)                                           MAIN
      CALL OBSHOK ( AMACH,GAM,P0,RHO0,T0,PT0,TT0,A0,ANG,M1,P1,RHO1,T1,  MAIN
     *              PT1,TT1,A1,AOAT1,AOAST1 )                           MAIN
      WAUNIT =  RHO1*M1*A1*32.174                                       MAIN
      IF(WAUNIT.LT.0.001)  WAUNIT = 0.001                               MAIN
C     COMPUTE AIR FLOWRATE FOR FULL CAPTURE.                            MAIN
      WAFULL = RHO1*AINLET*M1*A1                                        MAIN
C     COMPUTE CAPTURED AIR FLOWRATE                                     MAIN
      LOCX = LOCENG(3)                                                  MAIN
      LOCY = LOCX + NPT3                                                MAIN
      CALL FTLUP(M1,CAPR,1,NPT3,TAB(LOCX),TAB(LOCY))                    MAIN
C     CONVERT AIR FLOWRATE TO LB/SEC.                                   MAIN
      WACAP = WAFULL*CAPR*32.174                                        MAIN
C     DELIN IS THE INLET WEDGE ANGLE                                    MAIN
      ANG = ANG + DELIN                                                 MAIN
      CALL OBSHOK(M1,GAM,P1,RHO1,T1,PT1,TT1,A1,DELIN,M2,P2,RHO2,T2,     MAIN
     *              PT2,TT2,A2,AOAT2,AOAST2 )                           MAIN
      WASPIN = WAFULL*32.174 - WACAP                                    MAIN
      ADRAG = WASPIN/WAUNIT                                             MAIN
      ALIFT = ADRAG/TANIN                                               MAIN
      DRAG = (P2 - P0)*ADRAG                                            MAIN
      LIFT = (P2 - P1)*ALIFT                                            MAIN
      DINLET = DRAG*COSG + LIFT*SING                                    MAIN
      LINLET = LIFT*COSG - DRAG*SING                                    MAIN
      COSB = COS(ANG/57.2958)                                           MAIN
      SINB = SIN(ANG/57.2958)                                           MAIN
      IF(IOP.NE.3)  GO TO 22                                            MAIN
      WASPIL = WACAP                                                    MAIN
      GO TO 501                                                         MAIN
   22 CONTINUE                                                          MAIN
C     COMPUTE  TOT PRESS RATIO   STA-3/STA-1                            MAIN
      LOCX = LOCENG(4)                                                  MAIN
      LOCY = LOCX + NPT4                                                MAIN
      CALL FTLUP(M1,PT3PT1,1,NPT4,TAB(LOCX),TAB(LOCY))                  MAIN
C     COMPUTE TURBOJET CORRECTED AIRFLOW AT FULL THROTTLE               MAIN
      IF( (INSCAL.GT.2).OR.(INSCAL.EQ.0) ) GO TO 21                     MAIN
C     ITITIALIZE TJ SCALING FACTOR FOR SCALING CASE.  THIS OPTION MUST  MAIN
C     BE CALLED WITH MACH=ALT=0.                                        MAIN
      TJFACT = 1.0                                                      MAIN
   21 CONTINUE                                                          MAIN
      LOCX = LOCENG(5)                                                  MAIN
      LOCY = LOCX + NPT5                                                MAIN
      CALL FTLUP (TT1,WAMAX,1,NPT5,TAB(LOCX),TAB(LOCY) )                MAIN
C     COMPUTE FREESTREAM TEMPERATURE AND PRESSURE RATIOS.               MAIN
      THETA = TT1/518.67                                                MAIN
      DELTA = PT3PT1*PT1/2116.22                                        MAIN
C     COMPUTE MAX TURBOJET AIRFLOW REQUIRED AT COMPRESSOR FACE.         MAIN
      WAMAX =  WAMAX *DELTA /SQRT(THETA)*TJFACT                         MAIN
      LOCX = LOCENG(7)                                                  MAIN
      LOCY = LOCX + NPT7                                                MAIN
      CALL FTLUP ( TT1,WFWA,1,NPT7,TAB(LOCX),TAB(LOCY) )                MAIN
C     COMPUTE TJ GROSS THRUST AT FULL THROTTLE                          MAIN
      PN = P0                                                           MAIN
      IF(IPN.EQ.1)  PN=P1                                               MAIN
      PT3OPN = PT3PT1*PT1/PN                                            MAIN
      PTLOG = ALOG10(PT3OPN)                                            MAIN
      IF( PTLOG.LE. -.0458 )  PTLOG = -.045799                          MAIN
      NFG = NPTX6 * NPTZ6                                               MAIN
      LOCX = LOCENG(6)                                                  MAIN
      LOCZ = LOCX + NPTX6                                               MAIN
      LOCY = LOCZ + NPTZ6                                               MAIN
      CALL DISCOT ( TT1,PTLOG,TAB(LOCX),TAB(LOCY),TAB(LOCZ), 111,NFG,   MAIN
     *NPTZ6,FGOVWA,IERROR)                                              MAIN
      IF(IERROR.EQ.0) GO TO 25                                          MAIN
      WRITE(6,26)  AMACH,ALT                                            MAIN
   26 FORMAT (1H0,5X,52HERROR IN TABLE LOOKUP FOR GROSS THRUST/AIRFLOW RMAIN
     *ATIO,* MACH = *,F6.2,* ALT =*,E12.6)                              MAIN
      GO TO 999                                                         MAIN
   25 CONTINUE                                                          MAIN
      FGMAX = WAMAX*FGOVWA                                              MAIN
      IF(INSCAL.EQ.5)  GO TO 2700                                       MAIN
      IF((INSCAL.EQ.0).OR.(INSCAL.GT.2))  GO TO 27                      MAIN
      IF(INSCAL.EQ.2)  GO TO 28                                         MAIN
C     DRAM = 0. WHEN SCALING TJ                                         MAIN
      FTJNET = FGMAX*COSG - DRAM                                        MAIN
      TJFACT= ( FREQ + DRAM)/(FGMAX*COSG)                               MAIN
      GO TO 29                                                          MAIN
   28 TJFACT = TJCAIR*DELTA/(WAMAX*SQRT(THETA))                         MAIN
   29 WATJ = WAMAX*TJFACT                                               MAIN
      WFTJ = WATJ*WFWA                                                  MAIN
      FGMAX = FGMAX*TJFACT                                              MAIN
      FAVTJ = FGMAX*COSG - DRAM                                         MAIN
      SFC = WFTJ/FGMAX                                                  MAIN
      SFCOUT = SFC*3600.                                                MAIN
      TSETTJ = 1.0                                                      MAIN
      FTOTTJ = FGMAX                                                    MAIN
      FAVTOT=FAVTJ                                                      MAIN
      WFTOT=WFTJ                                                        MAIN
      GO TO 710                                                         MAIN
C     ADJUST INLET AREA TO SUPPLY MAX REQUIRED TJ AIRFLOW AT CRUISE.    MAIN
 2700 WATJ = WAMAX                                                      MAIN
      AINLET = WATJ/(RHO1*M1*A1*CAPR*32.174)                            MAIN
      WRITE(6,2701)  AINLET                                             MAIN
 2701 FORMAT(1H ,2X,*INLET AREA FOR MAX AIRFLOW REQD AT CRUISE-*,       MAIN
     1G13.5,* (SQ. FT.) *)                                              MAIN
      GO TO 2000                                                        MAIN
   27 CONTINUE                                                          MAIN
C     COMPUTE AREA OF TJ STREAMTUBE AT STA 1                            MAIN
      ATJ = WAMAX / WAUNIT                                              MAIN
C     COMPUTE RAM DRAG                                                  MAIN
      DRAM = ( (WAMAX*M1*A1/32.1739) + (P1 - P0)*ATJ)*COSG              MAIN
C     COMPUTE MAX FUEL FLOW RATE                                        MAIN
      FTOTL=0.                                                          MAIN
      WFMAX = WAMAX * WFWA                                              MAIN
      ITER = 0                                                          MAIN
      FNMAX = FGMAX - DRAM/COSG                                         MAIN
C     SFC IS BASED ON NET THRUST                                        MAIN
      SFCMAX = WFMAX/FNMAX                                              MAIN
      FTOTTJ = ( FREQ + DRAM + DINLET )/COSG                            MAIN
      IF ( INTSET.EQ. -1 ) FTOTTJ = FGMAX*TSETTJ                        MAIN
C     COMPUTE THROTTLE SETTING                                          MAIN
  100 TSETTJ = FTOTTJ / FGMAX                                           MAIN
      INDTHR = 0                                                        MAIN
      IF ( INTSET.EQ. 1 ) TSETTJ = 1.01                                 MAIN
      IF(TSETTJ.LE.1.0)  GO TO 30                                       MAIN
C     THIS ROUTINE ASSUMES (1) IF REQUIRED THRUST .LE. MAX TURBOJET     MAIN
C     THRUST THEN THE TURBOJET SUPPLIES ALL THE THRUST REQUIRED         MAIN
      TSETC  = TSETTJ                                                   MAIN
      INDTHR = 1                                                        MAIN
      TSETTJ = 1.0                                                      MAIN
      FTOTTJ = FGMAX                                                    MAIN
      IF( (IOP.EQ.2) .OR. (INTSET.EQ.1) )  GO TO 30                     MAIN
      WRITE (6,40)  TSETC                                               MAIN
   40 FORMAT(1H0,5X,64HTHRUST REQUIRED EXCEEDS MAX THRUST.  COMPUTED THRMAIN
     *OTTLE SETTING = ,F6.2  ,5X,27HTHROTTLE SETTING SET TO 1.0 )       MAIN
   30 CON1 = FTOTTJ                                                     MAIN
      LOCX = LOCENG(8)                                                  MAIN
      LOCY = LOCX + NPT8                                                MAIN
      CON2 = M1*A1/32.1739 + (P1 - P0)/WAUNIT                           MAIN
      TSNET = CON1/FNMAX                                                MAIN
      IF(TSNET.GT.1.)  TSNET=1.                                         MAIN
      CALL FTLUP (TSNET,SFCRAT,1,NPT8,TAB(LOCX),TAB(LOCY) )             MAIN
      ITRWA = 0                                                         MAIN
      SFC = SFCMAX*SFCRAT                                               MAIN
      WFTJ = SFC*CON1                                                   MAIN
      DWA1 = - WFTJ/WFWA                                                MAIN
C     FN1 IS MAX NET THRUST.  FN2 IS MIN NET THRUST                     MAIN
      FN1=FTOTTJ                                                        MAIN
      FN2=FTOTTJ+CON2*DWA1                                              MAIN
   31 CONTINUE                                                          MAIN
       TSNET = FN2/FNMAX                                                MAIN
      IF(TSNET.GT.1.)  TSNET=1.                                         MAIN
      CALL FTLUP (TSNET,SFCRAT,1,NPT8,TAB(LOCX),TAB(LOCY) )             MAIN
      SFC = SFCMAX*SFCRAT                                               MAIN
      WFTJ = SFC*FN2                                                    MAIN
C     COMPUTE TURBOJET AIRFLOW RATE REQUIRED.                           MAIN
      WATJ = WFTJ/WFWA                                                  MAIN
      IF( ABS(FN2 - FN1) .LE. 1.0)  GO TO 34                            MAIN
      WATJR = (CON1 - FN2)/CON2                                         MAIN
      DWA2 = WATJR - WATJ                                               MAIN
      IF( ABS(DWA2) .LE. 0.001*WAMAX ) GO TO 34                         MAIN
      IF(ITRWA.GT.ITRMAX) GO TO 32                                      MAIN
      SLOPE = (DWA2 - DWA1) / (FN2 - FN1)                               MAIN
      IF(ABS(SLOPE).LT.1.0E-06)  GO TO 34                               MAIN
      FN1 = FN2                                                         MAIN
      DWA1 = DWA2                                                       MAIN
      FN2 = FN2 - DWA2/SLOPE                                            MAIN
      ITRWA=ITRWA+1                                                     MAIN
      GO  TO 31                                                         MAIN
   32 WRITE (6,33)                                                      MAIN
   33 FORMAT (1H0,10X,* $ $ $ TOO MANY ITERATIONS IN RAM DRAG ITERATION MAIN
     1LOOP $ $ $ *,/)                                                   MAIN
      GO TO 999                                                         MAIN
   34 CONTINUE                                                          MAIN
      SFCOUT=SFC*3600.                                                  MAIN
C     COMPUTE RAM DRAG                                                  MAIN
      DRAM = WATJ*CON2*COSG                                             MAIN
      WASPIL = 0.                                                       MAIN
      DRAG = 0.                                                         MAIN
      LIFT = 0.                                                         MAIN
      WASPSV = 0.                                                       MAIN
      IF( WATJ.GT.WACAP) GO TO 50                                       MAIN
C     COMPUTE SPILLED AIRFLOW                                           MAIN
      WASPIL = WACAP - WATJ                                             MAIN
      WASPSV = WASPIL                                                   MAIN
   50 CONTINUE                                                          MAIN
C     SET SPILLED AIRFLOW FOR DEBUG PRINT                               MAIN
      WASRJ = WASPIL                                                    MAIN
C     COMPUTE TJ SPILLAGE LIFT AND DRAG                                 MAIN
      ADRAG = WASPIL/WAUNIT                                             MAIN
      ALIFT = ADRAG/TANIN                                               MAIN
      DRAG = (P2 - P0)*ADRAG                                            MAIN
      LIFT = (P2 - P1)*ALIFT                                            MAIN
      DSPILL = DRAG*COSG + LIFT*SING + DINLET                           MAIN
      LSPILL = LIFT*COSG - DRAG*SING + LINLET                           MAIN
      FAVTJ = FTOTTJ*COSG - DRAM - DSPILL                               MAIN
      WATOT = WATJ                                                      MAIN
      WFTOT = WFTJ                                                      MAIN
      FAVTOT = FAVTJ                                                    MAIN
      IF(INTSET.NE.0)  GO TO 500                                        MAIN
      IF ( ABS(FREQ - FAVTJ) .LT. 0.001*FREQ )  GO TO 700               MAIN
      IF( (FAVTJ - FREQ).GT.0.001*FREQ)  GO TO 53                       MAIN
      IF( (INDTHR.EQ.1).AND.(IOP.EQ.2) )  GO TO 500                     MAIN
      IF ( INDTHR .EQ. 1 ) GO TO 690                                    MAIN
   53 CONTINUE                                                          MAIN
      IF (ITER.LE.ITRMAX) GO TO 55                                      MAIN
      WRITE (6,52)                                                      MAIN
   52 FORMAT (1H0,5X,64HMAXIMUM NUMBER OF ITERATIONS EXCEEDED IN TURBOJEMAIN
     *T ITERATION LOOP, )                                               MAIN
      GO TO 999                                                         MAIN
   55 ITER = ITER + 1                                                   MAIN
      ITRTJ = ITER                                                      MAIN
      IF (ITER.GT.1) GO TO 60                                           MAIN
      FTOTL = FTOTTJ                                                    MAIN
      FTOTTJ = FTOTTJ + 0.1*(FREQ - FAVTJ)                              MAIN
      FAVL = FAVTJ                                                      MAIN
      GO TO 100                                                         MAIN
   60 CONTINUE                                                          MAIN
      DELF =  (FREQ - FAVTJ)*(FTOTTJ - FTOTL)/(FAVTJ - FAVL)            MAIN
      FTOTL = FTOTTJ                                                    MAIN
      FAVL  = FAVTJ                                                     MAIN
      FTOTTJ = FTOTTJ + DELF                                            MAIN
      GO TO 100                                                         MAIN
C     RAMJET COMPUTATIONS                                               MAIN
  500 CONTINUE                                                          MAIN
      IF ( IOP.LT. 2 ) GO TO 700                                        MAIN
      FAVTJ = FTOTTJ*COSG - DRAM - DINLET                               MAIN
  501 CONTINUE                                                          MAIN
      IF(AINLET.LE.0.1)  AINLET = 5.                                    MAIN
      IF( WASPIL.LT. 0.001) GO TO 600                                   MAIN
C     RAMJET AIRFLOW RATIO.                                             MAIN
      LOCX = LOCENG(10)                                                 MAIN
      LOCY = LOCX + NPT10                                               MAIN
      CALL FTLUP ( TT2,WOWRM,1,NPT10,TAB(LOCX),TAB(LOCY) )              MAIN
      WARMAX = WOWRM*WAFULL*32.174                                      MAIN
      IF(WARMAX.GT.1.0)  GO TO 502                                      MAIN
      WRITE(6,503)  TT2,AMACH,ALT                                       MAIN
  503 FORMAT(1H0,5X,*$$$  FLIGHT CONDITIONS OUT OF RAMJET OPERATING LIMIMAIN
     1TS,  TT2= *,E10.3,* MACH =*,F6.2,* ALT =*,E12.6)                  MAIN
      IF(IOP.EQ.3)  FAVTOT=0.                                           MAIN
      IF( (IOP.NE.3) .AND. (INTSET.EQ.0) )  WRITE(6,601)                MAIN
      GO TO 999                                                         MAIN
  502 CONTINUE                                                          MAIN
      WARAM  = WARMAX                                                   MAIN
C     RAMJET  FUEL/AIR RATIO AND SPECIFIC IMPULSE.                      MAIN
      LOCX = LOCENG (9)                                                 MAIN
      LOCY = LOCX + NPT9                                                MAIN
      CALL FTLUP (M0,ISPR,1,NPT9,TAB(LOCX),TAB(LOCY) )                  MAIN
      LOCY = LOCY + NPT9                                                MAIN
      CALL FTLUP (M0,PHIR,1,NPT9,TAB(LOCX),TAB(LOCY) )                  MAIN
      ITER = 0                                                          MAIN
  605 CONTINUE                                                          MAIN
      LIFT = 0.                                                         MAIN
      DRAG = 0.                                                         MAIN
      WASRJ = 0.                                                        MAIN
      WASPSV = 0.                                                       MAIN
      INDSPL = 0                                                        MAIN
      IF(WARAM.GT.WARMAX ) WARAM = WARMAX                               MAIN
      IF ( INTSET .EQ. -1 ) WARAM = WARMAX*TSETRJ                       MAIN
      IF( WARAM .GE. WASPIL ) GO TO 610                                 MAIN
      WASRJ = WASPIL - WARAM                                            MAIN
      WASPSV = WASRJ                                                    MAIN
      INDSPL = 1                                                        MAIN
      ADRAG = WASRJ/WAUNIT                                              MAIN
      ALIFT = ADRAG/TANIN                                               MAIN
      LIFT = (P2 - P1)*ALIFT                                            MAIN
      DRAG = (P2 - P0)*ADRAG                                            MAIN
      GO TO 615                                                         MAIN
  610 WARAM = WASPIL                                                    MAIN
  615 CONTINUE                                                          MAIN
      LSPILL = LIFT*COSG - DRAG*SING + LINLET                           MAIN
      DSPILL = DRAG*COSG + LIFT*SING + DINLET                           MAIN
      WFRAM = PHIR*WARAM* 0.0292                                        MAIN
      FTOTRJ = WFRAM*ISPR                                               MAIN
      FAVRAM = FTOTRJ*COSG - DSPILL                                     MAIN
C     FOR COMBINATION OPTION, INLET SPILLAGE DRAG IS CONTAINED IN NET   MAIN
C     TURBOJET THRUST                                                   MAIN
      IF(IOP.EQ.2)  FAVRAM = FAVRAM + DINLET                            MAIN
      WFTOT = WFRAM + WFTJ                                              MAIN
      WATOT = WARAM + WATJ                                              MAIN
      FAVTOT = FAVTJ + FAVRAM                                           MAIN
      TSETRJ = WARAM/WARMAX                                             MAIN
      IF(INTSET.NE.0)  GO TO 700                                        MAIN
      IF( ABS(FAVTOT - FREQ) .LT. 0.001*FREQ )  GO TO 700               MAIN
      IF( (FAVTOT - FREQ).GT. 0.001*FREQ )  GO TO 620                   MAIN
      IF(ABS(TSETRJ - 1.0 ).LT.0.001 ) GO TO 600                        MAIN
      IF(INDSPL.NE.0) GO TO 620                                         MAIN
  600 WRITE (6,601)                                                     MAIN
  601 FORMAT (1H0,5X,51HTOTAL THRUST AVAILABLE IS LESS THAN THRUST REQUIMAIN
     *RED, )                                                            MAIN
      GO TO 690                                                         MAIN
  620 CONTINUE                                                          MAIN
      IF (ITER.LE.ITRMAX) GO TO 630                                     MAIN
      WRITE ( 6,631)                                                    MAIN
  631 FORMAT (1H0,5X,62HMAXIMUM NUMBER OF ITERATIONS EXCEEDED IN RAMJET MAIN
     *ITERATION LOOP, )                                                 MAIN
      GO TO 999                                                         MAIN
  630 CONTINUE                                                          MAIN
      ITER = ITER + 1                                                   MAIN
      ITRRJ = ITER                                                      MAIN
      IF(ITER.GT.1) GO TO 640                                           MAIN
      DELWA = (FREQ - FAVTOT)/(PHIR*ISPR)                               MAIN
      GO TO 650                                                         MAIN
  640 DELWA =  (FREQ - FAVTOT)*(WARAM - WARL)/(FAVTOT - FAVL)           MAIN
  650 CONTINUE                                                          MAIN
      WARL = WARAM                                                      MAIN
      WARAM = WARAM + DELWA                                             MAIN
      IF(IPDENG.EQ.0)  GO TO 651                                        MAIN
      WRITE(6,555)  WARAM,WARL,FAVTOT,WFRAM,DSPILL,LSPILL,ITERIN        MAIN
  555 FORMAT(1H ,*  RJ  *,6E12.3,I5)                                    MAIN
  651 CONTINUE                                                          MAIN
      FAVL = FAVTOT                                                     MAIN
      GO TO 605                                                         MAIN
  690 CONTINUE                                                          MAIN
      IF(INSCAL.NE.3)  GO TO 700                                        MAIN
      IF(ITERIN.GT.INSMAX ) GO TO 696                                   MAIN
      IF(ITERIN.GT.0 ) GO TO 695                                        MAIN
      FAVDOT = -FAVTOT/AINLET                                           MAIN
      GO TO 699                                                         MAIN
  695 FAVDOT =  (FAVTL - FAVTOT ) / (AINLET - AILAST )                  MAIN
  699 AILAST = AINLET                                                   MAIN
      FAVTL = FAVTOT                                                    MAIN
      IF(FAVTOT.GT.0.)  GO TO 691                                       MAIN
      AINLET = 1.25*AINLET                                              MAIN
      GO TO 6696                                                        MAIN
  691 CONTINUE                                                          MAIN
      AINLET = AINLET - (FREQ - FAVTOT ) / FAVDOT                       MAIN
 6696 CONTINUE                                                          MAIN
      ITERIN = ITERIN + 1                                               MAIN
      IF(IPDENG.EQ.0)  GO TO 1                                          MAIN
      WRITE(6,666)  FAVTOT,FREQ,FAVTL,FAVDOT,AINLET,AILAST,ITERIN       MAIN
  666 FORMAT(1H ,6E12.3,I5)                                             MAIN
      GO TO 1                                                           MAIN
  696 WRITE(6,632)                                                      MAIN
  632 FORMAT (1H0,5X,*MAXIMUM NUMBER OF INLET SCALING ITERATIONS EXCEEDEMAIN
     1D.*, )                                                            MAIN
      GO TO 710                                                         MAIN
  700 CONTINUE                                                          MAIN
      DENGIN = DSPILL - DINLET                                          MAIN
      IF( (INSCAL.NE.3).OR.(DENGIN.LT.0.001*FREQ) )  GO TO 710          MAIN
C     REDUCE INLET AREA TO ELIMINATE ENGINE SPILLAGE DRAG               MAIN
      ITERIN = ITERIN + 1                                               MAIN
      AINLET = AINLET - WASPSV/(RHO1*M1*A1*CAPR*COSG*32.2)              MAIN
      IF(IPDENG.EQ.0)  GO TO 709                                        MAIN
      WRITE(6,555)  WARAM,WARL,FAVTOT,WFRAM,DSPILL,LSPILL,ITERIN        MAIN
  709 CONTINUE                                                          MAIN
      IF(ITERIN.GT.INSMAX)  GO TO 696                                   MAIN
      GO TO 1                                                           MAIN
  710 CONTINUE                                                          MAIN
C     ADD RAM DRAG AND THRUST COMPONENTS TO LIFT                        MAIN
      LSPILL=LSPILL - DRAM*SING/COSG + (FTOTTJ + FTOTRJ)*SING           MAIN
      IF(IOP.EQ.3)  GO TO 999                                           MAIN
      IF(INSCAL.NE.0)  GO TO 999                                        MAIN
      IF(WATJ.GT.WACAP)  WRITE(6,750)  WACAP,WATJ                       MAIN
  750 FORMAT(1H0,5X,* INLET TOO SMALL FOR TURBOJET.  CAP. AIR =*,E10.3, MAIN
     1*  TJ. AIR =*,E10.3,)                                             MAIN
  999 CONTINUE                                                          MAIN
      IF ( INSCAL.EQ.0 ) GO TO 2000                                     MAIN
      IF ( INSCAL.GT.2 )  GO TO 2000                                    MAIN
C     WRITE TJ PERFORMANCE PARAMETERS                                   MAIN
      WRITE (6,2999)                                                    MAIN
 2999 FORMAT(1H1,20X,*TURBOJET PERFORMANCE (PER ENGINE) AT SEA LEVEL STAMAIN
     1TIC CONDITIONS *,//)                                              MAIN
      WRITE (6,3000)  FGMAX                                             MAIN
 3000 FORMAT(1H ,5X,*TURBOJET GROSS THRUST - - - - - - - - - - *,G13.6, MAIN
     1* (LB)* )                                                         MAIN
      WRITE (6,3001)  FAVTJ                                             MAIN
 3001 FORMAT(1H ,5X,*NET THRUST IN FREESTREAM DIRECTION  - - - *,G13.6, MAIN
     1* (LB)* )                                                         MAIN
      WRITE (6,3002)  WATJ                                              MAIN
 3002 FORMAT(1H ,5X,*AIRFLOW RATE  - - - - - - - - - - - - - - *,G13.6, MAIN
     1* (LB/SEC)* )                                                     MAIN
      WRITE (6,3003)  WFTJ                                              MAIN
 3003 FORMAT(1H ,5X,*FUELFLOW RATE - - - - - - - - - - - - - - *,G13.6, MAIN
     1* (LB/SEC) *  )                                                   MAIN
      WRITE (6,3004)  SFCOUT                                            MAIN
 3004 FORMAT(1H ,5X,*SPECIFIC FUEL CONSUMPTION - - - - - - - - *,G13.6, MAIN
     1* ((LB FUEL/HR)/LB THRUST) * )                                    MAIN
      WRITE (6,3005)  TJFACT                                            MAIN
 3005 FORMAT(1H ,5X,*BASE ENGINE SCALING FACTOR  - - - - - - - *,G13.6, MAIN
     1* (NO UNITS) * )                                                  MAIN
      WAMPRN = WAMAX * SQRT(THETA)/DELTA                                MAIN
      WRITE (6,3006)  WAMPRN                                            MAIN
 3006 FORMAT(1H ,5X,*MAXIMUM AIRFLOW RATE OF BASE ENGINE - - - *,G13.6, MAIN
     1* (LB/SEC) * )                                                    MAIN
      WRITE (6,3007)  PT3OPN                                            MAIN
 3007 FORMAT(1H ,5X,*PRESSURE RATIO (PT3/PN) - - - - - - - - - *,G13.6, MAIN
     1* (NO UNITS) * )                                                  MAIN
      WRITE (6,3008)  ALPHA                                             MAIN
 3008 FORMAT(1H ,5X,*ANGLE OF ATTACK - - - - - - - - - - - - - *,G13.6, MAIN
     1* (DEGREES)  * )                                                  MAIN
      WRITE (6,3009)  DELW                                              MAIN
 3009 FORMAT(1H ,2X,*   WING HALF ANGLE- - - - - - - - - - - - - -*,    MAIN
     1G13.6,* (DEGREES) * )                                             MAIN
      WRITE (6,3010)  DELIN                                             MAIN
 3010 FORMAT(1H ,2X,*   INLET WEDGE ANGLE- - - - - - - - - - - - -*,    MAIN
     1G13.6,* (DEGREES) * )                                             MAIN
      IF( INSCAL.EQ.1)  WRITE (6,3011)  FREQ                            MAIN
 3011 FORMAT(1H ,2X,*   SCALING THRUST IN FREESTREAM DIRECTION - -*,    MAIN
     1G13.6,* (LB) * )                                                  MAIN
      IF( INSCAL.EQ.2)  WRITE (6,3012)  TJCAIR                          MAIN
 3012 FORMAT(1H ,2X,*   SCALING CORRECTED AIRFLOW RATE - - - - - -*,    MAIN
     1G13.6,* (LB/SEC) * )                                              MAIN
      WRITE (6,3013) LSPILL                                             MAIN
 3013 FORMAT(1H ,5X,*LIFT COMPONENT OF ENGINE FORCES - - - - - *,G13.6, MAIN
     1* (LB) * )                                                        MAIN
      GO TO 2000                                                        MAIN
 1100 CONTINUE                                                          MAIN
C     WRITE RJ PERFORMANCE PARAMETERS                                   MAIN
      WRITE(6,4000)                                                     MAIN
 4000 FORMAT(1H1,20X,*RAMJET PERFORMANCE (PER ENGINE) AT SCALING ALTITUDMAIN
     1E AND MACH NUMBER *,// )                                          MAIN
      WRITE(6,4001) FTOTRJ                                              MAIN
 4001 FORMAT(1H ,5X,*RAMJET GROSS THRUST - - - - - - - - - - - *,G13.6, MAIN
     1* (LB) * )                                                        MAIN
      WRITE(6,3001) FAVRAM                                              MAIN
      WRITE(6,3002) WARAM                                               MAIN
      WRITE(6,3003) WFRAM                                               MAIN
      WRITE(6,4002) ISPR                                                MAIN
 4002 FORMAT(1H ,5X,*SPECIFIC IMPULSE  - - - - - - - - - - - - *,G13.6, MAIN
     1* (SEC) * )                                                       MAIN
      WRITE(6,4003) PHIR                                                MAIN
 4003 FORMAT(1H ,5X,*SCALED FUEL/AIR RATIO (PHI) - - - - - - - *,G13.4, MAIN
     1* (NO UNITS) * )                                                  MAIN
      WRITE(6,4004) ALT                                                 MAIN
 4004 FORMAT(1H ,5X,*SCALING ALTITUDE  - - - - - - - - - - - - *,G13.6, MAIN
     1* (FEET) * )                                                      MAIN
      WRITE(6,4005) AMACH                                               MAIN
 4005 FORMAT(1H ,5X,*SCALING MACH NUMBER - - - - - - - - - - - *,G13.4, MAIN
     1* (NO UNITS) * )                                                  MAIN
      WRITE(6,4006) WARMAX                                              MAIN
 4006 FORMAT(1H ,5X,*MAXIMUM AIRFLOW RATE  - - - - - - - - - - *,G13.6, MAIN
     2* (LB/SEC)  * )                                                   MAIN
      WRITE(6,3008) ALPHA                                               MAIN
      WRITE(6,3009) DELW                                                MAIN
      WRITE(6,3010) DELIN                                               MAIN
      WRITE(6,3011) FREQ                                                MAIN
      WRITE(6,3013) LSPILL                                              MAIN
      WRITE(6,4007) DINLET                                              MAIN
      WRITE(6,4010)  AINLET                                             MAIN
 4010 FORMAT(1H ,5X,*ENGINE INLET AREA - - - - - - - - - - - - *,G13.5, MAIN
     1* (SQ. FT) * )                                                    MAIN
 4007 FORMAT(1H ,5X,*INLET SPILLAGE DRAG - - - - - - - - - - - *,G13.6, MAIN
     1* (LB) * )                                                        MAIN
      WRITE (6,4008)  TSETRJ                                            MAIN
 4008 FORMAT(1H ,5X,*RAMJET THROTTLE SETTING - - - - - - - - - *,G13.3, MAIN
     1* (NO UNITS) * )                                                  MAIN
      WRITE(6,4009)                                                     MAIN
 4009 FORMAT(1H1)                                                       MAIN
 2000 CONTINUE                                                          MAIN
      IF(IDEBUG.LT.10)  RETURN                                          MAIN
      WRITE(6,5000)                                                     MAIN
 5000 FORMAT(1H0,2X,*    ALT            MACH        CAP AIR       TJ AIRMAIN
     1         RJ AIR       SPILLED AIR * )                             MAIN
      WRITE(6,5010)  ALT,AMACH,WACAP,WATJ,WARAM,WASRJ                   MAIN
      WRITE(6,5001)                                                     MAIN
 5001 FORMAT(1H0,2X,*   RJ FUEL       TJ FUEL      TJ-TOT-THR    RJ-TOT-MAIN
     1THR    TJ-NET-THR    RJ-NET-THR   *  )                            MAIN
      WRITE(6,5010)  WFRAM,WFTJ,FTOTTJ,FTOTRJ,FAVTJ,FAVRAM              MAIN
      WRITE (6,5003)                                                    MAIN
 5003 FORMAT(1H0,2X,*   PHI-RAM       ISP-RAM       TOT-TEMP-2      ALPHMAIN
     1A     RJ-AIR-RATIO * )                                            MAIN
      WRITE (6,5010)  PHIR,ISPR,TT2,ALPHA,WOWRM                         MAIN
      WRITE(6,5002)                                                     MAIN
 5002 FORMAT(1H0,2X,*  RAM DRAG      INLET DRAG     SPILL DRAG * )      MAIN
      WRITE(6,5010)  DRAM,DINLET,DSPILL                                 MAIN
 5010 FORMAT(1H ,2X,6(2X,G12.5) )                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX1(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(129), XA0   )                                  MAIN
      EQUIVALENCE (XNSEG(130), XA1   )                                  MAIN
      EQUIVALENCE (XNSEG(131), XA2   )                                  MAIN
      EQUIVALENCE (XNSEG(132), XA3   )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(652), IPATH )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 1     CLIMB GIVEN ALT. SCHEDULE (FORWARD OR REVERSE)       MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      IF(TZ(ITZ+6) .GT. 0.0)  GO TO 202                                 MAIN
C                                                                       MAIN
C     FORWARD CALCULATION                                               MAIN
C     WITH RESPECT TO FLIGHT DIRECTION                                  MAIN
C                                                                       MAIN
      AMS=AM                                                            MAIN
      WTKEP=WT                                                          MAIN
      AME=TZ(ITZ)                                                       MAIN
      H0=H                                                              MAIN
      HE=TZ(ITZ+1)                                                      MAIN
      REVFLG = 1.                                                       MAIN
  205 CONTINUE                                                          MAIN
      IF(ABS(H0-HE) .GE. 1.0)  GO TO 204                                MAIN
      CALL XCEL                                                         MAIN
      DAC=ABS(DAC)                                                      MAIN
      TAC=ABS(TAC)                                                      MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
 204  XQFP=2.1                                                          MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      XA2=0.0                                                           MAIN
      XA3=0.0                                                           MAIN
C                                                                       MAIN
      INDMHP = TZ(ITZ+2)                                                MAIN
      IPATH = TZ(ITZ+3)                                                 MAIN
      WRITE(6, 1001) IPATH, INDMHP                                      MAIN
 1001 FORMAT(32H0 INDICATORS FOR PATH GENERATION/ 10H0 IPATH = I2, 10X, MAIN
     1       10H INDMHP = I2)                                           MAIN
C     GENERATE CLIMB PATH                                               MAIN
      IF(IPATH .LE. 0)  GO TO 3000                                      MAIN
      IF(IPATH .GT. 5)  GO TO 3000                                      MAIN
      IF(IPATH .LE. 3  .AND. INDMHP .LE. 0)  GO TO 40                   MAIN
      IF(IPATH .LE. 3  .AND. INDMHP .GT. 5)  GO TO 40                   MAIN
      GO TO (10, 20, 30, 40, 50), IPATH                                 MAIN
   10 CONTINUE                                                          MAIN
      CALL EDCLMB                                                       MAIN
      GO TO 2000                                                        MAIN
   20 CONTINUE                                                          MAIN
      CALL HDCLMB                                                       MAIN
      GO TO 2000                                                        MAIN
   30 CONTINUE                                                          MAIN
      CALL MDCLMB                                                       MAIN
      GO TO 2000                                                        MAIN
   40 CONTINUE                                                          MAIN
      CALL LNCLMB                                                       MAIN
      GO TO 2000                                                        MAIN
   50 CONTINUE                                                          MAIN
      CALL QCLIMB                                                       MAIN
 2000 CONTINUE                                                          MAIN
      RXC = ABS(CRANGE(KPATH))                                          MAIN
      TTC = ABS( CTIME(KPATH))/60.0                                     MAIN
      RETURN                                                            MAIN
 3000 CONTINUE                                                          MAIN
      CALL CLIMB                                                        MAIN
      RXC=ABS(RXC)                                                      MAIN
      TTC=ABS(TTC)                                                      MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  202 CONTINUE                                                          MAIN
C     REVERSE CALCULATION                                               MAIN
C     WITH RESPECT TO FLIGHT DIRECTION                                  MAIN
C                                                                       MAIN
      WTKEP=WT                                                          MAIN
      AMS=AM                                                            MAIN
      H0=H                                                              MAIN
      AME=TZ(ITZ)                                                       MAIN
      HE=TZ(ITZ+1)                                                      MAIN
      XTT=-XTT                                                          MAIN
      REVFLG = -1.                                                      MAIN
      GO TO 205                                                         MAIN
      END                                                               MAIN
      SUBROUTINE INX22                                                  MAIN
      DIMENSION  A(8),B(8),C(8),V(2),X(8)                               MAIN
      INTEGER  QXICS,QXICF                                              MAIN
      INTEGER  QXFLS,QXFS                                               MAIN
      COMMON  /QXFILB/  QXFLS,QXFS(133)                                 MAIN
      COMMON  /INXXA/  LA,A,LB,B,LC,C,LV,V,LX,X,Z(20)                   MAIN
      COMMON  /INXXB/  REVCAL,NOEND,TERM(10)                            MAIN
      COMMON  /COMSEG/  XNSEG(775)                                      MAIN
      LOGICAL  NOEND                                                    MAIN
C     THIS SUBROUTINE CONTROLS AN ITERATION LOOP BEGINNING AT THE START MAIN
C     OF SEGMENT (I)  AND ENDING AT THE END OF SEGMENT (J) .            MAIN
C     THE ITERATION LOOP CAN BE BEGUN ONLY WITH A SEGMENT WHICH UTILIZESMAIN
C     AN OPTION WHICH READS IN THE QUANTITY TO BE VARIED.               MAIN
C                                                                       MAIN
C     TERM(1)  =  INDICATOR SET DEPENDING ON QUANTITY TO BE VARIED AT   MAIN
C                 THE BEGINNING OF SEGMENT (I)                          MAIN
C                                                                       MAIN
C                 1 = WEIGHT                                            MAIN
C                 2 = RANGE                                             MAIN
C                 3 = MACH                                              MAIN
C                                                                       MAIN
C     TERM(2)  =  INDICATOR SET DEPENDING ON QUANTITY TO BE SATISFIED ATMAIN
C                 THE END OF SEGMENT (J)                                MAIN
C                                                                       MAIN
C                 1 = WEIGHT                                            MAIN
C                 2 = RANGE                                             MAIN
C                 3 = MACH                                              MAIN
C                                                                       MAIN
C     TERM(3)  =  VALUE DESIRED FOR QUANTITY SPECIFIED BY TERM(2).      MAIN
C                                                                       MAIN
C     TERM(4)  =  NUMBER OF SEGMENT (I)                                 MAIN
C                                                                       MAIN
C     TERM(5)  =  NUMBER OF SEGMENT (J)                                 MAIN
C                                                                       MAIN
C     TERM(9)  =  NUMBER OF ITERATIONS - - DEFAULT  VALUE = 3           MAIN
C                  SAMPLE  DATA  CASE                                   MAIN
C                                                                       MAIN
C     SEGMENT(27),OPTION(22),                                           MAIN
C                                                                       MAIN
C     START LOOP AT SEGMENT (4) ----- WEIGHT IS TO BE VARIED            MAIN
C                                                                       MAIN
C     FINISH  LOOP AT SEGMENT (26) ----  RANGE IS TO BE SATISFIED       MAIN
C                                                                       MAIN
C     NUMBER OF ITERATIONS =  3.,                                       MAIN
C                                                                       MAIN
C     DESIRED RANGE =  1500., MILES                                     MAIN
C                                                                       MAIN
C     END                                                               MAIN
C                                                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
      TERM(9) = 3.0                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT (1,LC,C )                                             MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (5,5HSTART,JMP)                                       MAIN
      GO TO ( 20,100),JMP                                               MAIN
   20 IWRD = 4                                                          MAIN
      JWRD = 1                                                          MAIN
   25 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (8,8HSEGMENT(,JMP)                                    MAIN
      GO TO  (30,888),JMP                                               MAIN
C     FIND  START SEG  NUMBER                                           MAIN
   30 CONTINUE                                                          MAIN
      CALL QXIFRC (1,1H),JMP)                                           MAIN
      GO TO (35,888),JMP                                                MAIN
   35 CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV,V,Z)                                               MAIN
      CALL BCDINT  (Z,LV,INT)                                           MAIN
      TERM(IWRD)=INT                                                    MAIN
  200 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (6,6HWEIGHT,JMP)                                      MAIN
      GO TO (205,210),JMP                                               MAIN
  205 TERM(JWRD) = 1.0                                                  MAIN
      GO TO 10                                                          MAIN
  210 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRANGE,JMP)                                        MAIN
      GO TO (215,220),JMP                                               MAIN
  215 TERM(JWRD) = 2.0                                                  MAIN
      GO TO 10                                                          MAIN
  220 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC(4,4HMACH,JMP)                                         MAIN
      GO TO (225,10),JMP                                                MAIN
  225 TERM (JWRD) = 3.0                                                 MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (6,6HFINISH,JMP)                                      MAIN
      GO TO (110,300),JMP                                               MAIN
  110 IWRD = 5                                                          MAIN
      JWRD = 2                                                          MAIN
      GO TO 25                                                          MAIN
  888 WRITE ( 6,889)  C                                                 MAIN
  889 FORMAT (1H0,5X, *INPUT ERROR ON CARD----*,8A10,)                  MAIN
      GO TO 999                                                         MAIN
  300 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HNUMBER,JMP)                                       MAIN
      GO TO (310,400),JMP                                               MAIN
  310 IWRD = 9                                                          MAIN
  320 CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (1,1H=,JMP)                                           MAIN
      GO TO  (330,888),JMP                                              MAIN
  330 CALL QXIFRC (1,1H,,JMP)                                           MAIN
      GO TO (340,888),JMP                                               MAIN
  340 CALL QXIREC                                                       MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD ( LV,V,Z)                                             MAIN
      CALL BCDDEC ( Z,LV,TERM(IWRD) )                                   MAIN
      GO TO 10                                                          MAIN
  400 CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (7,7HDESIRED,JMP)                                     MAIN
      GO TO (410,500), JMP                                              MAIN
  410 IWRD = 3                                                          MAIN
      GO TO 320                                                         MAIN
  500 CALL ALLUSE                                                       MAIN
      IF (NOEND) GO TO 10                                               MAIN
  999 RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XCLECT(NOPT, TZ, RG, NSR)                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      REAL TZ(1)                                                        MAIN
      REAL RG(1)                                                        MAIN
      DATA NCALL /1/                                                    MAIN
      REVFLG = 1.                                                       MAIN
      MGIVEN = .TRUE.                                                   MAIN
      NCALL = NCALL +1                                                  MAIN
      WRITE(6, 9000) NCALL, NOPT, WT, H, AM, TIME, RANGE, FUEL          MAIN
 9000 FORMAT(1H0, I3, 30H. ****** XCLECT START  OPTION I3, 7H ******/   MAIN
     1 20X, 8HWT    = G12.5, 5X, 8HH     = G12.5, 5X, 8HAM    = G12.5// MAIN
     2 20X, 8HTIME  = G12.5, 5X, 8HRANGE = G12.5, 5X, 8HFUEL  = G12.5)  MAIN
      NSR = 0                                                           MAIN
      IF(NOPT.EQ.22) GO TO 22                                           MAIN
      GO TO (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21),NOPTMAIN
    1 CONTINUE                                                          MAIN
      CALL OPTXX1(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    2 CONTINUE                                                          MAIN
      CALL OPTXX2(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    3 CONTINUE                                                          MAIN
      CALL OPTXX3(TZ, RG, NSR)                                          MAIN
      GO TO 777                                                         MAIN
    4 CONTINUE                                                          MAIN
      CALL OPTXX4(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    5 CONTINUE                                                          MAIN
      CALL OPTXX5(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    6 CONTINUE                                                          MAIN
      CALL OPTXX6(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    7 CONTINUE                                                          MAIN
      CALL OPTXX7(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    8 CONTINUE                                                          MAIN
      CALL OPTXX8(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
    9 CONTINUE                                                          MAIN
      CALL OPTXX9(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   10 CONTINUE                                                          MAIN
      CALL OPTX10(TZ, RG)                                               MAIN
      GO TO 777                                                         MAIN
   11 CONTINUE                                                          MAIN
      CALL OPTX11(TZ, RG)                                               MAIN
      GO TO 777                                                         MAIN
   12 CONTINUE                                                          MAIN
      CALL OPTX12(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   13 CONTINUE                                                          MAIN
      CALL OPTX13(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   14 CONTINUE                                                          MAIN
      CALL OPTX14(TZ, RG)                                               MAIN
      GO TO 777                                                         MAIN
   15 CONTINUE                                                          MAIN
      CALL OPTX15(TZ, RG, NSR)                                          MAIN
      GO TO 777                                                         MAIN
   16 CONTINUE                                                          MAIN
      CALL OPTX16(TZ, RG)                                               MAIN
      GO TO 777                                                         MAIN
   17 CONTINUE                                                          MAIN
      CALL OPTX17(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   18 CONTINUE                                                          MAIN
      CALL OPTX18(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   19 CONTINUE                                                          MAIN
      CALL OPTX19(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   20 CONTINUE                                                          MAIN
      CALL OPTX20(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   21 CONTINUE                                                          MAIN
      CALL OPTX21(TZ)                                                   MAIN
      GO TO 777                                                         MAIN
   22 CONTINUE                                                          MAIN
      CALL OPTX22 (TZ,RG,NSR)                                           MAIN
C                                                                       MAIN
  777 CONTINUE                                                          MAIN
      WRITE(6, 9010) NCALL, NOPT, WT, H, AM, TIME, RANGE, FUEL          MAIN
 9010 FORMAT(1H0, I3, 30H. ****** XCLECT END    OPTION I3, 7H ******/   MAIN
     1 20X, 8HWT    = G12.5, 5X, 8HH     = G12.5, 5X, 8HAM    = G12.5// MAIN
     2 20X, 8HTIME  = G12.5, 5X, 8HRANGE = G12.5, 5X, 8HFUEL  = G12.5// MAIN
     3       30(4H +++)/1H0/1H0)                                        MAIN
      CALL ELT                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE UNPACK(TZ, MTZ)                                        MAIN
      COMMON /COMTAB/ C(2000)                                           MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(340), OPTION)                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      EQUIVALENCE (XNSEG(360), LOCRG )                                  MAIN
      EQUIVALENCE (XNSEG(579), IPTZXX)                                  MAIN
      EQUIVALENCE (XOUT, IOUT)                                          MAIN
      INTEGER CCPXX                                                     MAIN
      INTEGER CASEN                                                     MAIN
      INTEGER CASE                                                      MAIN
      INTEGER PSET                                                      MAIN
      INTEGER OPTION                                                    MAIN
      REAL TZ(1)                                                        MAIN
      INTEGER MTZ(1)                                                    MAIN
      LOGICAL IPXX(10)                                                  MAIN
      INTEGER T                                                         MAIN
      DATA T /2/                                                        MAIN
      XOUT = TZ(ITZ +9)                                                 MAIN
      IEXP = 10**9                                                      MAIN
      DO 100 I=1,10                                                     MAIN
      IPXX(I) = .FALSE.                                                 MAIN
      L = IOUT/IEXP                                                     MAIN
      IF(L .EQ. T)  IPXX(I) = .TRUE.                                    MAIN
      IOUT = IOUT - L*IEXP                                              MAIN
      IEXP = IEXP/10                                                    MAIN
  100 CONTINUE                                                          MAIN
      CCPXX = MTZ(ITZ +5)                                               MAIN
      CASEN = CCPXX/10000                                               MAIN
      CASE = (CCPXX -CASEN*10000)/1000                                  MAIN
      PSET = (CCPXX -CASEN*10000 -CASE*1000)/100                        MAIN
      IXTT = CCPXX -100*(10*(10*CASEN +CASE) +PSET)                     MAIN
      XTT = FLOAT(IXTT)                                                 MAIN
      OPTION = MTZ(ITZ +7)                                              MAIN
      IF(IPTZXX .EQ. 0)  RETURN                                         MAIN
      L = ITZ -1                                                        MAIN
      WRITE(6, 102) ITZ, CCPXX, CASEN, CASE, PSET, IXTT, XTT, OPTION    MAIN
  102 FORMAT(7H UNPACK, 6I10, F10.0, I10)                               MAIN
      WRITE(6, 101)       (TZ(L+K), K=1,10)                             MAIN
 101  FORMAT(1X,5G12.5,I12,G12.5,I12,G12.5,2X,I10)                      MAIN
      WRITE(6, 103)                                                     MAIN
  103 FORMAT(1H1)                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CLIMB                                                  MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE   (XNSEG(735),IPN     ),(XNSEG(736),IDEBUG  )         MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 93), FWC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(120), TOL   )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(123), W     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(138), XQWE  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(157), YZA   )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      INTEGER PSET, PSAVE                                               MAIN
      LOGICAL IPXX(10)                                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES CLIMBS AND DESCENTS                           MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      IF(H0 .NE. HE)  GO TO 77                                          MAIN
      WRITE(6, 70) H0                                                   MAIN
   70 FORMAT(46H0 WARNING   ***   CLIMB CALLED WITH H0 = HE = G12.4)    MAIN
      RETURN                                                            MAIN
   77 CONTINUE                                                          MAIN
      RXC=0.0                                                           MAIN
      TTC=0.0                                                           MAIN
      FWC=0.0                                                           MAIN
      XNZZ=1.0                                                          MAIN
      H1=H0                                                             MAIN
      H2=HE                                                             MAIN
      YZA = 1.0                                                         MAIN
      IF(H2 .LT. H1)  YZA = -1.0                                        MAIN
      W=WT                                                              MAIN
      TOL = 0.001                                                       MAIN
      H = H0                                                            MAIN
      AM = AMS                                                          MAIN
      CALL ATMOSD                                                       MAIN
C                                                                       MAIN
C          NOTE...   PATH MAY CHOP POWER TO MATCH MACH ALT PATH   ...   MAIN
      PSAVE = PSET                                                      MAIN
      CALL PATH                                                         MAIN
      PSET = PSAVE                                                      MAIN
C                                                                       MAIN
      W=WT                                                              MAIN
      RCE=RC                                                            MAIN
      VXE=VX                                                            MAIN
      FFRE=FN*SFC/3600.0                                                MAIN
      DH=(H2-H1)/XTT                                                    MAIN
      NXTT=ABS(XTT)                                                     MAIN
C                                                                       MAIN
      DO 25 I=1,NXTT                                                    MAIN
      H=H+DH                                                            MAIN
      FFR=FN*SFC/3600.0                                                 MAIN
      W=-(DH/RC)*FFR+W                                                  MAIN
      IF(WT .LE. XQWE)  GO TO 55                                        MAIN
C                                                                       MAIN
C          NOTE...   PATH MAY CHOP POWER TO MATCH MACH ALT PATH   ...   MAIN
      PSAVE = PSET                                                      MAIN
      CALL PATH                                                         MAIN
      PSET = PSAVE                                                      MAIN
C                                                                       MAIN
      IF(XNZZ .GT. 1.0)  GO TO 900                                      MAIN
      RCS=RCE                                                           MAIN
      RCE=RC                                                            MAIN
      VXS=VXE                                                           MAIN
      VXE=VX                                                            MAIN
      FFRS=FFRE                                                         MAIN
      FFRE=FN*SFC/3600.0                                                MAIN
      DT=DH*ALOG(RCS/RCE)/(RCS-RCE)                                     MAIN
      DW =        DT*(FFRE+FFRS)/2.0                                    MAIN
      WT=WT-DW                                                          MAIN
      W=WT                                                              MAIN
      RXC=RXC+DT*(VXS+VXE)/12160.4                                      MAIN
      FWC=FWC+DW                                                        MAIN
      TTC=TTC+DT/60.0                                                   MAIN
   25 CONTINUE                                                          MAIN
C                                                                       MAIN
      RXC=RXC                                                           MAIN
      TTC=TTC/60.0                                                      MAIN
      GO TO 900                                                         MAIN
   55 CONTINUE                                                          MAIN
      XNZZ=3.0                                                          MAIN
C                                                                       MAIN
  900 CONTINUE                                                          MAIN
      IDBSAV = IDEBUG                                                   MAIN
      IF(IDEBUG.GT. 0)  IDEBUG = 100                                    MAIN
      IF(IDEBUG.GT. 10 ) CALL ENDAT                                     MAIN
      IDEBUG = IDBSAV                                                   MAIN
      IF(IPXX(5))  CALL OUTXXX(5)                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE LNCLMB                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      COMMON /COMSEG/  XNSEG(775)                                       MAIN
      EQUIVALENCE  (XNSEG(127),XQSW  ),(XNSEG(79),CL    )               MAIN
      EQUIVALENCE  (XNSEG(97),PS     ),(XNSEG(85),DRT   )               MAIN
      EQUIVALENCE  (XNSEG(183),Q     ),(XNSEG(72),AM    )               MAIN
      EQUIVALENCE  (XNSEG(94),H      ),(XNSEG(124),WT   )               MAIN
      EQUIVALENCE  (XNSEG(193),MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      CALL INIMHP                                                       MAIN
      NUMMH = 20                                                        MAIN
      DELH = (HE -H0)/NUMMH                                             MAIN
      DELAM = (AME -AMS)/NUMMH                                          MAIN
C                                                                       MAIN
      K = 1                                                             MAIN
      DO 100 I=1,NUMMH                                                  MAIN
      HE = H0 +DELH                                                     MAIN
      AME = AMS +DELAM                                                  MAIN
      AM = AME                                                          MAIN
      H = HE                                                            MAIN
      MGIVEN = .TRUE.                                                   MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q * XQSW                                                     MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      CALL FLYMHP                                                       MAIN
      H0 = HE                                                           MAIN
      AMS = AME                                                         MAIN
  100 CONTINUE                                                          MAIN
C                                                                       MAIN
      CALL MHPTAB(4)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE HDAMPT(WT, HPT, AMPT)                                  MAIN
      COMMON/COMSEG/  XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(192), VELA  )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(658), EDOT  )                                  MAIN
      REAL LIFT                                                         MAIN
      REAL LOD, LOD1, LOD2, LOD3                                        MAIN
      REAL LOTMD, LOTMD1, LOTMD2, LOTMD3                                MAIN
      REAL Y(5)                                                         MAIN
      COMMON /YICSET/       Y1(5), Y2(5), Y3(5)                         MAIN
      EQUIVALENCE (Y(1), EDOT), (Y(2), EDOMD), (Y(3), LOD), (Y(4), RF)  MAIN
      EQUIVALENCE (Y(5), LOTMD)                                         MAIN
      EQUIVALENCE (Y1(1), EDOT1 ), (Y2(1), EDOT2 ), (Y3(1), EDOT3 )     MAIN
      EQUIVALENCE (Y1(2), EDOMD1), (Y2(2), EDOMD2), (Y3(2), EDOMD3)     MAIN
      EQUIVALENCE (Y1(3), LOD1  ), (Y2(3), LOD2  ), (Y3(3), LOD3  )     MAIN
      EQUIVALENCE (Y1(4), RF1   ), (Y2(4), RF2   ), (Y3(4), RF3   )     MAIN
      EQUIVALENCE (Y1(5), LOTMD1), (Y2(5), LOTMD2), (Y3(5), LOTMD3)     MAIN
      LOGICAL MGIVEN                                                    MAIN
      NAME LIST /DBAMP/ J, JJ, SPEED1, SPEED2, SPEED3,                  MAIN
     1                  VEL, H, AM, SPEEDO, YMAX, INDMHP, Y, Y1, Y2, Y3,MAIN
     1                  COEFA, COEFB, COEFC, WT, SE, HPT, AMPT,         MAIN
     1                  CL, DRT, FN, Q, QS, QLIM, AMLIM                 MAIN
      DATA TWOG /64.4/                                                  MAIN
      LIFT = WT                                                         MAIN
      CALL SETYIC(Y)                                                    MAIN
      YMAX = -0.0                                                       MAIN
      SPEEDO = -0.0                                                     MAIN
      SPEED1 = -0.0                                                     MAIN
      SPEED2 = -0.0                                                     MAIN
      SPEED3 = -0.0                                                     MAIN
      COEFA = -0.0                                                      MAIN
      COEFB = -0.0                                                      MAIN
      COEFC = -0.0                                                      MAIN
      JJ = 0                                                            MAIN
      MGIVEN = .TRUE.                                                   MAIN
      AM = AMLIM                                                        MAIN
      H = HPT                                                           MAIN
      CALL ATMOSD                                                       MAIN
      DELV = SPEED/20.0                                                 MAIN
      MGIVEN = .FALSE.                                                  MAIN
      SPEED = 0.0                                                       MAIN
      DO 50 J=1,20                                                      MAIN
      SPEED = SPEED +DELV                                               MAIN
      VEL = 0.5921*SPEED                                                MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      IF(CL .GT. CLMAX)  GO TO 50                                       MAIN
      LIM = 0                                                           MAIN
      IF(Q.GT.QLIM) GO TO 49                                            MAIN
      AM = VEL/VELA                                                     MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
C     IF(EDOT .LE. 0.0)  GO TO 50                                       MAIN
      IF(FFR.LE.0.00001)  GO TO 47                                      MAIN
      EDOMD = EDOT*3600.0/FFR                                           MAIN
      RF = (LIFT/DRT)*(VEL/SFC)                                         MAIN
   47 CONTINUE                                                          MAIN
      LOD = LIFT/DRT                                                    MAIN
      LOTMD = 1.0E20                                                    MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 48                              MAIN
      LOTMD = LIFT/(FN -DRT)                                            MAIN
   48 CONTINUE                                                          MAIN
      IF(Y(INDMHP) .LT. Y2(INDMHP))  GO TO 50                           MAIN
      EDOT2 = EDOT                                                      MAIN
      EDOMD2 = EDOMD                                                    MAIN
      LOD2 = LOD                                                        MAIN
      RF2 = RF                                                          MAIN
      LOTMD2 = LOTMD                                                    MAIN
      SPEED2 = SPEED                                                    MAIN
      GO TO 50                                                          MAIN
   49 LIM = 1                                                           MAIN
   50 CONTINUE                                                          MAIN
C     COMPUTE MACH ALTITUDE POINT FOR THIS SPECIFIC ENERGY              MAIN
      SPEEDO = SPEED2                                                   MAIN
      IND=2                                                             MAIN
      AM=SPEED2*0.5921/VELA                                             MAIN
      WRITE(6,6666)  IND,AM,H,SPEED2,PS,FN,FFR,LOD2,EDOT2               MAIN
      IF(SPEED2.LE.0.01)  GO TO 200                                     MAIN
C     IF MAX POINT IS FIRST NONZERO VELOCITY POINT COMPUTATIONS WILL    MAIN
C     BLOW UP.  THEREFORE, CURVE FIT IS SKIPPED.                        MAIN
      IF(SPEED2.LE.DELV)  GO TO 60                                      MAIN
      SPEED1 = SPEED2 -DELV                                             MAIN
      SPEED3 = SPEED2 +DELV                                             MAIN
      VEL = 0.5921*SPEED1                                               MAIN
      AM = VEL/VELA                                                     MAIN
      Q = 0.5*RHO*SPEED1**2                                             MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(FFR.LE.0.001)  GO TO 60                                        MAIN
      EDOT1 = (FN -DRT)*SPEED1/WT                                       MAIN
      EDOMD1 = EDOT1*3600.0/FFR                                         MAIN
      LOD1 = LIFT/DRT                                                   MAIN
      IND = 1                                                           MAIN
      WRITE(6,6666)  IND,AM,H,SPEED1,PS,FN,FFR,LOD1,EDOT1               MAIN
      RF1 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD1 = 1.0E20                                                   MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 55                              MAIN
      LOTMD1 = LIFT/(FN -DRT)                                           MAIN
   55 CONTINUE                                                          MAIN
      VEL = 0.5921*SPEED3                                               MAIN
      AM = VEL/VELA                                                     MAIN
      Q = 0.5*RHO*SPEED3**2                                             MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(FFR.LT.0.001)  GO TO 60                                        MAIN
      EDOT3 = (FN -DRT)*SPEED3/WT                                       MAIN
      EDOMD3 = EDOT3*3600.0/FFR                                         MAIN
      LOD3 = LIFT/DRT                                                   MAIN
      IND = 3                                                           MAIN
      WRITE(6,6666)  IND,AM,H,SPEED3,PS,FN,FFR,LOD3,EDOT3               MAIN
      RF3 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD3 = 1.0E20                                                   MAIN
      IF(ABS(FN - DRT).LE.0.001)  GO TO 58                              MAIN
      LOTMD3 = LIFT/(FN -DRT)                                           MAIN
   58 CONTINUE                                                          MAIN
      IF(Q.GT.QLIM)  LIM=1                                              MAIN
      IF ( LIM.NE.0 ) GO TO 60                                          MAIN
      CALL XFIT2(SPEED1,SPEED2,SPEED3,                                  MAIN
     1     Y1(INDMHP),Y2(INDMHP),Y3(INDMHP),                            MAIN
     1           COEFA, COEFB, COEFC,                                   MAIN
     1           SPEEDO, YMAX, DUM, DUM)                                MAIN
   60 CONTINUE                                                          MAIN
      VEL = 0.5921*SPEEDO                                               MAIN
      AM = VEL/VELA                                                     MAIN
      AMPT = AM                                                         MAIN
      MGIVEN = .TRUE.                                                   MAIN
      Q=0.5*RHO*SPEEDO**2                                               MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
      LOD=LIFT/DRT                                                      MAIN
      IND = 0                                                           MAIN
      WRITE(6,6666)  IND,AM,H,SPEEDO,PS,FN,FFR,LOD,EDOT                 MAIN
 6666 FORMAT(1H ,5X,I5,2X,8(1X,G12.5) )                                 MAIN
      IF(CL .GT. CLMAX)  GO TO 200                                      MAIN
      IF(Q .GT. QLIM)  GO TO 200                                        MAIN
C     IF(EDOT .GT. 0.0)  RETURN                                         MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      WRITE(6, DBAMP)                                                   MAIN
      MGIVEN = .TRUE.                                                   MAIN
      WRITE(6, 100)                                                     MAIN
  100 FORMAT(64H0 WARNING   ***   THE VEHICLE CAN NOT FLY AT THE ABOVE CMAIN
     1ONDITION)                                                         MAIN
C     AMPT = -0.0                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OBSHOK (MBEFOR,GAM,PBEFOR,RHOBEF,TBEFOR,PTBEF,TTBEF,   MAIN
     *    SMABEF,ANG,MAFT,PAFT,RHOAFT,TAFT,PTAFT,TTAFT,SMAAFT,AOATAF,   MAIN
     *           AOASAF )                                               MAIN
C     TO GO THROUGH ANY OBLIQUE SHOCK                                   MAIN
C                                                                       MAIN
C                                                                       MAIN
      COMPLEX ROOT,TEMP                                                 MAIN
      REAL  MBEFOR,MAFT,MIDDLE,MBEFT,MSQ                                MAIN
      DIMENSION  A(4),ROOT(3)                                           MAIN
      DIMENSION  MBEFT(45),DELMXT(45)                                   MAIN
      DATA  NDELMX /42/, (MBEFT(I),I=1,42 ) / 1.0,1.05,1.10,1.15,       MAIN
     * 1.20,1.25,1.30,1.35,1.40,1.45,1.50,1.55,1.60,1.65,1.70,1.75,1.80,MAIN
     * 1.85,1.90,1.95,2.00,2.05,2.10,2.15,2.20,2.25,2.30,2.35,2.40,2.45,MAIN
     * 2.50,2.60,2.70,2.80,2.90,3.00,3.10,3.20,4.0,5.0,10.0,100.0 /     MAIN
      DATA  (DELMXT(I),I=1,42) / 0.0,0.558,1.515,2.684,3.944,5.286,     MAIN
     * 6.662,8.048,9.427,10.785,12.113,13.403,14.652,15.855,17.012,     MAIN
     * 18.121,19.183,20.198,21.168,22.091,22.973,23.813,24.614,25.376,  MAIN
     * 26.103,26.794,27.454,28.082,28.682,29.253,29.798,30.814,31.740,  MAIN
     * 32.587,33.363,34.073,34.727,35.327,38.,41.,44.,45.5  /           MAIN
C                                                                       MAIN
C     ANG IS ALPHA+DELTW OR WDGDEL                                      MAIN
      IF(MBEFOR.LT.1..OR.ANG.LT..00001)GOTO100                          MAIN
C                                                                       MAIN
      CALLFTLUP(MBEFOR,TEST,1,NDELMX,MBEFT(1),DELMXT(1))                MAIN
C                                                                       MAIN
      IF(ANG.GE.TEST)GOTO99                                             MAIN
C                                                                       MAIN
C     COMPUTE THETA FROM CUBIC                                          MAIN
C                                                                       MAIN
      A(1)=(1.)                                                         MAIN
C                                                                       MAIN
      A(2)=-(MBEFOR**2+2.)/MBEFOR**2-GAM*SIN(ANG*.01745329)**2          MAIN
      A(3)=(2.*MBEFOR**2+1.)/MBEFOR**4+((GAM+1.)**2/4.+                 MAIN
     1(GAM-1.)/MBEFOR**2)*SIN(ANG*.01745329)**2                         MAIN
C                                                                       MAIN
C                                                                       MAIN
      A(4)=-COS(ANG*.01745329)**2/MBEFOR**4                             MAIN
C                                                                       MAIN
      B=A(2)                                                            MAIN
      C=A(3)                                                            MAIN
      D=A(4)                                                            MAIN
C                                                                       MAIN
      CALL RPOLY ( 3,A,ROOT,IERR)                                       MAIN
C                                                                       MAIN
      IF(IERR)94,95,94                                                  MAIN
   94 WRITE(6,301)ROOT                                                  MAIN
  301 FORMAT (1H0,16H  ERROR IN RPOLY,/,6E17.8 )                        MAIN
      STOP                                                              MAIN
C                                                                       MAIN
C     TEST TO FIND IMAGINARY ROOTS                                      MAIN
C                                                                       MAIN
   95 IF(ABS(AIMAG(ROOT(1))).LT..00001.AND.ABS(AIMAG(ROOT(2))).LT.      MAIN
     1.00001.AND.ABS(AIMAG(ROOT(3))).LT..00001)GO TO 97                 MAIN
      WRITE(6,300)B,C,D,ROOT                                            MAIN
  300 FORMAT(17H  IMAGINARY ROOTS,4E17.8/6E17.8)                        MAIN
      WRITE(6,1234)  MBEFOR,GAM,ANG                                     MAIN
C     SOLUTION IS TAKEN TO BE THE REAL ROOT                             MAIN
      II = 1                                                            MAIN
      IF(ABS(AIMAG(ROOT(1))).LT.0.00001)  GO TO 96                      MAIN
      II = 2                                                            MAIN
      IF(ABS(AIMAG(ROOT(2))).LT.0.00001)  GO TO 96                      MAIN
      II = 3                                                            MAIN
      GO TO 96                                                          MAIN
C                                                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
   97 BIG=AMAX1(REAL(ROOT(1)),REAL(ROOT(2)),REAL(ROOT(3)))              MAIN
      SMALL=AMIN1(REAL(ROOT(1)),REAL(ROOT(2)),REAL(ROOT(3)))            MAIN
      DO 98 I=1,3                                                       MAIN
      II=I                                                              MAIN
      IF(REAL(ROOT(I)).LT.BIG.AND.REAL(ROOT(I)).GT.SMALL) GO TO 96      MAIN
   98 CONTINUE                                                          MAIN
      WRITE(6,302)ROOT                                                  MAIN
  302 FORMAT(17H  TWO EQUAL ROOTS/2X,6E17.8)                            MAIN
C     TAKE SOLUTION TO BE THE VALUE OF THE EQUAL ROOTS.                 MAIN
      WRITE(6,1234)  MBEFOR,GAM,ANG                                     MAIN
 1234 FORMAT(1H0,10X,*$$$$$$$$ MACH, GAMMA, WEDGE ANGLE *,3G15.5)       MAIN
      II=1                                                              MAIN
      IF(REAL(ROOT(1)).EQ.REAL(ROOT(2))) GO TO 96                       MAIN
      IF(REAL(ROOT(1)).EQ.REAL(ROOT(3))) GO TO 96                       MAIN
      II = 2                                                            MAIN
      GO TO 96                                                          MAIN
   96 MIDDLE=REAL(ROOT(II))                                             MAIN
      ARG=SQRT(MIDDLE)                                                  MAIN
C                                                                       MAIN
C     ANGLE IS THET0 OR THET1                                           MAIN
C                                                                       MAIN
      ANGLE=ATAN(ARG/SQRT(1.-ARG**2))                                   MAIN
C                                                                       MAIN
      GOTO101                                                           MAIN
C                                                                       MAIN
  100 ANGLE=0.                                                          MAIN
      GAMPL=GAM+1.                                                      MAIN
      GAMMIN=GAM-1.                                                     MAIN
      MAFT=MBEFOR                                                       MAIN
      PAFT=PBEFOR                                                       MAIN
      RHOAFT=RHOBEF                                                     MAIN
      TAFT=TBEFOR                                                       MAIN
      PTAFT=PTBEF                                                       MAIN
      SMAAFT=SMABEF                                                     MAIN
      TTAFT=TTBEF                                                       MAIN
      AOATAF=1./SQRT(1.+GAMMIN/2.*MAFT**2)                              MAIN
      IF(MAFT.LT.0.0001)  GO TO 150                                     MAIN
      AOASAF=1./(GAMPL/2.)**(GAMPL/(2.*GAMMIN))/MAFT                    MAIN
     1*(1.+GAMMIN*MAFT**2/2.)**(GAMPL/(2.*GAMMIN))                      MAIN
      GO TO 500                                                         MAIN
  150 AOASAF=0.                                                         MAIN
C                                                                       MAIN
  500 RETURN                                                            MAIN
   99 ANGLE=.01745329*90.                                               MAIN
  101 MSQ=MBEFOR**2                                                     MAIN
      SINSQ=SIN(ANGLE)**2                                               MAIN
C                                                                       MAIN
      GAMPL=GAM+1.                                                      MAIN
      GAMMIN=GAM-1.                                                     MAIN
C                                                                       MAIN
      MAFT=SQRT((GAMPL**2*MSQ**2*SINSQ-4.*(MSQ*SINSQ-1.)*               MAIN
     1(GAM*MSQ*SINSQ+1.))/((2.*GAM*MSQ*SINSQ-GAMMIN)*                   MAIN
     2(GAMMIN*MSQ*SINSQ+2.)))                                           MAIN
C                                                                       MAIN
      PAFT=PBEFOR*(2.*GAM*MSQ*SINSQ-GAMMIN)/GAMPL                       MAIN
C                                                                       MAIN
      RHOAFT=RHOBEF*GAMPL*MSQ*SINSQ/(GAMMIN*MSQ*                        MAIN
     1SINSQ+2.)                                                         MAIN
C                                                                       MAIN
      TAFT=TBEFOR*(2.*GAM*MSQ*SINSQ-GAMMIN)*(GAMMIN*                    MAIN
     1MSQ*SINSQ+2.)/(GAMPL**2*MSQ*SINSQ)                                MAIN
C                                                                       MAIN
      PTAFT=PTBEF*(GAMPL*MSQ*SINSQ/(GAMMIN*MSQ*                         MAIN
     1SINSQ+2.))**(GAM/GAMMIN)*(GAMPL/(2.*GAM*MSQ*                      MAIN
     2SINSQ-GAMMIN))**(1./GAMMIN)                                       MAIN
C                                                                       MAIN
      TTAFT=TTBEF                                                       MAIN
C                                                                       MAIN
      SMAAFT=SQRT(GAM*PAFT/RHOAFT)                                      MAIN
C                                                                       MAIN
      AOATAF=1./SQRT(1.+GAMMIN/2.*MAFT**2)                              MAIN
C                                                                       MAIN
      AOASAF=1./(GAMPL/2.)**(GAMPL/(2.*GAMMIN))/MAFT                    MAIN
     1*(1.+GAMMIN*MAFT**2/2.)**(GAMPL/(2.*GAMMIN))                      MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
      END                                                               MAIN
      SUBROUTINE INIMHP                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      COMMON/CENDAT/  CFNET(25),CSFC(25)                                MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE  (XNSEG( 127 ), XQSW   )                              MAIN
      EQUIVALENCE  (XNSEG( 79  ), CL     )                              MAIN
      EQUIVALENCE  (XNSEG( 97  ), PS     )                              MAIN
      EQUIVALENCE  (XNSEG( 85  ), DRT    )                              MAIN
      EQUIVALENCE  (XNSEG( 183 ), Q      )                              MAIN
      EQUIVALENCE  (XNSEG( 115 ), SFC    )                              MAIN
      EQUIVALENCE  (XNSEG( 92  ), FN     )                              MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      MGIVEN = .TRUE.                                                   MAIN
      ENDPT(1) = AME                                                    MAIN
      ENDPT(2) = HE                                                     MAIN
      CRANGE(1) = 0.0                                                   MAIN
      CTIME(1) = 0.0                                                    MAIN
      CFUEL(1) = 0.0                                                    MAIN
      CUMWT(1) = WT                                                     MAIN
      PGAM7D(1) = 0.0                                                   MAIN
      H = H0                                                            MAIN
      AM = AMS                                                          MAIN
      CALL ATMOSD                                                       MAIN
      PVEL(1) = VEL                                                     MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      CFNET(1) = FN                                                     MAIN
      CSFC(1) = SFC                                                     MAIN
      XTT = 2                                                           MAIN
      AMPATH(1) = AMS                                                   MAIN
      HPATH(1) = H0                                                     MAIN
      H = H0                                                            MAIN
      AM = AMS                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE GOGO                                                   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 78), AVSFC )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(136), XQAE  )                                  MAIN
      EQUIVALENCE (XNSEG(137), XQA1  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(142), XQR1  )                                  MAIN
      EQUIVALENCE (XNSEG(145), XQT1  )                                  MAIN
      EQUIVALENCE (XNSEG(148), XQW1  )                                  MAIN
      EQUIVALENCE (XNSEG(149), XQW2  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(160), ZX6   )                                  MAIN
      EQUIVALENCE (XNSEG(161), ZX7   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(1),ASPEED),(ATMOS(5),PR)                       MAIN
      LOGICAL IPXX(10)                                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      INTEGER PSET                                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES CRUSES WHERE INDEPENDENT VARIAVLE IS TIME OR DMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      PSET=0                                                            MAIN
C     MOD1   CHANGES TO CONTANT H, AM CRUISE DUE TO AK1 AK2             MAIN
      NFP=XQFP                                                          MAIN
      NORN=1                                                            MAIN
      XQA1=H                                                            MAIN
      XQW1=WT                                                           MAIN
      NXTT=XTT                                                          MAIN
      SFCX=0.0                                                          MAIN
      GOTO(11,12,13,14,15,16),NFP                                       MAIN
   11 CONTINUE                                                          MAIN
      CALL ATMOSD                                                       MAIN
      VN=AM*ASPEED*.59208                                               MAIN
      TTR=RN/VN                                                         MAIN
  12  TXX=TTR/XTT                                                       MAIN
      GO TO 2                                                           MAIN
  14  RXX=RN/XTT                                                        MAIN
      GO TO 1                                                           MAIN
  16  NORN=2                                                            MAIN
   15 CONTINUE                                                          MAIN
      CALL ATMOSD                                                       MAIN
      VN=AM*ASPEED*0.59208                                              MAIN
      RXX=TTR*VN/XTT                                                    MAIN
  1   RN=0.0                                                            MAIN
      TTR=0.0                                                           MAIN
      XQBD=2.0                                                          MAIN
      HST=H                                                             MAIN
      CALL CHECK                                                        MAIN
      SFCB=SFC                                                          MAIN
      RFB=RFAC                                                          MAIN
      WB=WT                                                             MAIN
      VM=VN                                                             MAIN
C                                                                       MAIN
      DO 5 I=1,NXTT                                                     MAIN
      WA=WB                                                             MAIN
      IF(ZX6 .LE. 0.0)  GO TO 40                                        MAIN
      WA=WA-ZX7                                                         MAIN
      WT=WA                                                             MAIN
      CALL CHECK                                                        MAIN
      RFB=RFAC                                                          MAIN
      SFCB=SFC                                                          MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
 40   CONTINUE                                                          MAIN
      WT=WA/EXP(RXX/RFAC)                                               MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      SFCA=SFCB                                                         MAIN
      RFA=RFB                                                           MAIN
      SFCB=SFC                                                          MAIN
      RFB=RFAC                                                          MAIN
      WB=WA/(EXP(RXX/(.5*(RFB+RFA))))                                   MAIN
      DDR=RXX                                                           MAIN
      RN=RN+DDR                                                         MAIN
      VBAR=.5*(VN+VM)                                                   MAIN
      DTTR=DDR/VBAR                                                     MAIN
      VM=VN                                                             MAIN
      TTR=TTR+DTTR                                                      MAIN
      SFC=(SFCA+SFCB)/2.0                                               MAIN
      SFCX=SFCX+SFC                                                     MAIN
      IF(IPXX(8))  WRITE(6, 41) WT, RXX, RFB, RFA, VBAR                 MAIN
   41 FORMAT(6H0 GOGO, 5X, 5HWT = G12.4, 5X, 6HRXX = G12.4, 5X,         MAIN
     1       6HRFB = G12.4, 5X, 6HRFA = G12.4, 5X, 7HVBAR = G12.4)      MAIN
    5 CONTINUE                                                          MAIN
C                                                                       MAIN
      AVSFC=SFCX/XTT                                                    MAIN
      WT=WB                                                             MAIN
C                                                                       MAIN
   10 CONTINUE                                                          MAIN
      XQR1=RN                                                           MAIN
      XQT1=TTR                                                          MAIN
      XQAE=H                                                            MAIN
      XQW2=WT                                                           MAIN
      IF(IPXX(8))  CALL OUTXXX(8)                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  2   RN=0.0                                                            MAIN
      TTR=0.0                                                           MAIN
      CALL ATMOSD                                                       MAIN
      QS=XQSW*1481.352*PR*AM**2                                         MAIN
      XQBD=1.0                                                          MAIN
      CALL CHECK                                                        MAIN
      SFCB=SFC                                                          MAIN
      WB=WT                                                             MAIN
      XHOLD=0.0                                                         MAIN
      FFB=1.0/FFR                                                       MAIN
C                                                                       MAIN
      DO 6 I=1,NXTT                                                     MAIN
      WA=WB                                                             MAIN
      FFA=FFB                                                           MAIN
      IF(ZX6.LT.0.01) GO TO 201                                         MAIN
      WA=WA-ZX7                                                         MAIN
      WT=WA                                                             MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      FFA=1.0/FFR                                                       MAIN
 201  WB=WA-TXX/FFA                                                     MAIN
      WT=WB                                                             MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      FFB=1.0/FFR                                                       MAIN
      IF(ZX6.LT.0.01)GOTO202                                            MAIN
      XHOLD=ZX6                                                         MAIN
      WC=WA+TXX/FFA*0.5                                                 MAIN
      WT=WC                                                             MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      FFC=1.0/FFR                                                       MAIN
      GO TO 203                                                         MAIN
 202  WC=WA-0.25*TXX*(1.0/FFA+1.0/FFB)                                  MAIN
      WT=WC                                                             MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      FFC=1.0/FFR                                                       MAIN
 203  CALLXFIT2(WA,WB,WC,FFA,FFB,FFC,CC,BB,AA,XATYM,YM,XR,XRR)          MAIN
      WT=WB                                                             MAIN
      DO 20 J=1,5                                                       MAIN
      FFB=CC+(BB+WT*AA)*WT                                              MAIN
      WB=WT+((WA-WT)*(WA*(AA/3.0*(WA+WT)+BB/2.0)+WT*((AA/3.0)*WT+BB/2.0 MAIN
     1)+CC)-TXX)/FFB                                                    MAIN
      IF(ABS(WT-WB).LT.1.0) GO TO 21                                    MAIN
      WT=WB                                                             MAIN
   20 CONTINUE                                                          MAIN
 21   TTR=TTR+TXX                                                       MAIN
      RN=TTR*VN                                                         MAIN
      WT=WB                                                             MAIN
      IF(XHOLD.GT.0.01)CALLCHECK                                        MAIN
    6 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(ZX6.GT.0.01)WT=WT-ZX7                                          MAIN
      GO TO 10                                                          MAIN
 13   XQBD=5.1                                                          MAIN
      CALL CHECK                                                        MAIN
      XQBD=3.1                                                          MAIN
      CALL CHECK                                                        MAIN
      TXX=TTR/XTT                                                       MAIN
      TTR=0.0                                                           MAIN
      RN=0.0                                                            MAIN
      AA=SFC                                                            MAIN
      BB=0.0                                                            MAIN
      WB=WT                                                             MAIN
      SFCB=SFC                                                          MAIN
      VM=VN                                                             MAIN
C                                                                       MAIN
      DO 84 I=1,NXTT                                                    MAIN
      IF(ZX6.LT.0.01) GO TO 31                                          MAIN
      WB=WB-ZX7                                                         MAIN
      WT=WB                                                             MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      AA=SFC                                                            MAIN
      BB=0.0                                                            MAIN
 31   WT=AA/((BB*WB+AA)*EXP((AA/CLCD)*TXX)/WB-BB)                       MAIN
      WA=WB                                                             MAIN
      SFCA=SFC                                                          MAIN
      CALL CHECK                                                        MAIN
      IF(E10 .GT. 0.0)  GO TO 10                                        MAIN
      SFCB=SFC                                                          MAIN
      WB=WT                                                             MAIN
      BB=(SFCA-SFCB)/(WA-WB)                                            MAIN
      AA=SFCB-WB*BB                                                     MAIN
      WB=AA/((BB*WA+AA)*EXP((AA/CLCD)*TXX)/WA-BB)                       MAIN
      TTR=TTR+TXX                                                       MAIN
      RN=RN+4.0*CLCD*(VM-VN)/(SFCA+SFCB)                                MAIN
      VM=VN                                                             MAIN
   84 CONTINUE                                                          MAIN
C                                                                       MAIN
      WT=WB                                                             MAIN
      IF(ZX6.GT.0.01) WT=WT-ZX7                                         MAIN
      GO TO 10                                                          MAIN
      END                                                               MAIN
      SUBROUTINE OPTX17(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE  (XNSEG( 119 ), TTR    )                              MAIN
      EQUIVALENCE  (XNSEG( 183 ), Q      )                              MAIN
      EQUIVALENCE  (XNSEG( 127 ), XQSW   )                              MAIN
      EQUIVALENCE  (XNSEG( 79  ), CL     )                              MAIN
      EQUIVALENCE  (XNSEG( 97  ), PS     )                              MAIN
      EQUIVALENCE  (XNSEG( 85  ), DRT    )                              MAIN
      EQUIVALENCE (XNSEG(597),WL)                                       MAIN
      EQUIVALENCE (XNSEG( 30), AMTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 31), HTO   )                                  MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(203), WUTO  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(324), HOVTMI)                                  MAIN
      EQUIVALENCE (XNSEG(325), HOVSFC)                                  MAIN
      EQUIVALENCE (XNSEG(326), HOVT  )                                  MAIN
      EQUIVALENCE (XNSEG(605), W0    )                                  MAIN
      EQUIVALENCE (XNSEG(606), FN0   )                                  MAIN
      EQUIVALENCE (XNSEG(608), V50   )                                  MAIN
      EQUIVALENCE (XNSEG(609), W50   )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      INTEGER PSET                                                      MAIN
      INTEGER CASEN                                                     MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 17 FUEL WT CHANGE DUE TO   ...                             MAIN
C              1.   LOITER FOR SPECIFIED TIME                           MAIN
C              2.   WARM-UP FOR SPECIFIED TIME AND TAKE OFF             MAIN
C              3.   COMBAT FOR SPECIFIED TIME                           MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     1 FUEL WT CHANGE INPUTED                                          MAIN
C     2 FUEL WT CHANGE COMPUTED                                         MAIN
C     SUBOPTION DEFINED BY VALUE IN TZ(5)                               MAIN
C     1 LOITER FUEL COMPUTED                                            MAIN
C     2 WARMUP + TAKEOFF FUEL COMPUTED                                  MAIN
      CALL ATMOSD                                                       MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      DEGTRN = TZ(ITZ+1)                                                MAIN
      GLEVEL = TZ(ITZ+2)                                                MAIN
      TIME = TZ(ITZ+3)/60.0                                             MAIN
      TTR = TIME                                                        MAIN
      WTKEP = WT                                                        MAIN
      NFOPT=TZ(ITZ+6)+.1                                                MAIN
      GO TO(700,701,704,705),NFOPT                                      MAIN
 701  NFUL=TZ(ITZ+4)+.1                                                 MAIN
      GOTO(702,703),NFUL                                                MAIN
C                                                                       MAIN
  702 CONTINUE                                                          MAIN
C     COMPUTE LOITER FUEL                                               MAIN
      CALL ENDAT                                                        MAIN
      WT = WT -FFR*TIME                                                 MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  703 CONTINUE                                                          MAIN
C     COMPUTE WARM-UP AND TAKE-OFF FUEL                                 MAIN
      H = HTO                                                           MAIN
      AM = 0.0                                                          MAIN
      CALL ATMOSD                                                       MAIN
      IF(CASEN.NE.5) CASEN=1                                            MAIN
      PSET = 2                                                          MAIN
      CALL ENDAT                                                        MAIN
      FWARM = FFR*TIME                                                  MAIN
      IF(CASEN.NE.5) CASEN=3                                            MAIN
      PSET=1                                                            MAIN
      CALL ENDAT                                                        MAIN
      W0 = WT -FWARM                                                    MAIN
      FN0 = FN                                                          MAIN
      CALL TAKEOF                                                       MAIN
      H = H +50.0                                                       MAIN
      AM = V50/0.5921/1116.45                                           MAIN
      WUTO = FWARM +W0 -W50                                             MAIN
      WT = W50                                                          MAIN
      RETURN                                                            MAIN
  705 CONTINUE                                                          MAIN
      WL = WT                                                           MAIN
      CALL LANDIN                                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  700 CONTINUE                                                          MAIN
C     FUEL WT CHANGE GIVEN AS INPUT                                     MAIN
      WT=WTKEP-TZ(ITZ)                                                  MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  704 CONTINUE                                                          MAIN
C     COMBAT FUEL                                                       MAIN
      DEGDUM=ABS(DEGTRN)                                                MAIN
      CALL CBFUEL(DEGDUM, TIME)                                         MAIN
      IF( DEGTRN. LT .0.0) TIME=-TIME                                   MAIN
      WT = WT -FFR*TIME                                                 MAIN
      TTR = TIME                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ENDAT                                                  MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES THRUST AND SPECIFIC FUEL CONSUMPTION          MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C     CASEN=1.   DRY                                                    MAIN
C     CASEN=2.   WET                                                    MAIN
C     PSET=0.   PARTIAL POWER SETTING (PS=FNREQ)                        MAIN
C     PSET=1.   MAX. POWER (CHECK CASEN)                                MAIN
C     PSET=2.   MIN. POWER (CHECK CASEN)                                MAIN
C     PSET=3.   LOOK UP DIRECTLY (PS=FN/FNMAX DESIRED)                  MAIN
C     ERROR RETURNS                                                     MAIN
C        TABLE LOOK-UP ERRORS (CONTAINED IN E(11))                      MAIN
C        0 - NO ERRORS                                                  MAIN
C        1 - VARIABLES NOT IN ASCENDING ORDER                           MAIN
C        2 - ARGUMENT EXCEEDS LIMIT OF TABLE, EXTRAPOLATION NOT DESIRED MAIN
C        3 - NUMBER OF VALUES OF VARIABLE NOT GREATER THAN ONE          MAIN
C        4 - POSSIBLE MACHINE ERROR                                     MAIN
C        ENDAT ERRORS (CONTAINED IN E(10))                              MAIN
C        0 - NO ERRORS                                                  MAIN
C        1 - THRUST REQUIRED LESS THAN THRUST AT MINIMUM DRY POWER      MAIN
C        4 - THRUST REQUIRED GREATER THAN THRUST AT MAXIMUM WET POWER   MAIN
C            (SIZE REQUIRED TIMES 1000 IS CONTAINED IN FN)              MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(319), TSIZEF)                                  MAIN
      EQUIVALENCE (XNSEG(320), NUMENG)                                  MAIN
      EQUIVALENCE (XNSEG(321), SFCFAC)                                  MAIN
      EQUIVALENCE (XNSEG(495), LOCTFF)                                  MAIN
      EQUIVALENCE (XNSEG(516), INDT01)                                  MAIN
      EQUIVALENCE (XNSEG(517), INDT02)                                  MAIN
      EQUIVALENCE (XNSEG(518), INDT03)                                  MAIN
      EQUIVALENCE (XNSEG(519), INDT04)                                  MAIN
      EQUIVALENCE (XNSEG(520), INDT05)                                  MAIN
      EQUIVALENCE (XNSEG(521), INDT06)                                  MAIN
      EQUIVALENCE (XNSEG(522), IT01X )                                  MAIN
      EQUIVALENCE (XNSEG(523), IT02X )                                  MAIN
      EQUIVALENCE (XNSEG(524), IT03X )                                  MAIN
      EQUIVALENCE (XNSEG(525), IT04X )                                  MAIN
      EQUIVALENCE (XNSEG(526), IT05X )                                  MAIN
      EQUIVALENCE (XNSEG(527), IT06X )                                  MAIN
      EQUIVALENCE (XNSEG(528), IT01Y )                                  MAIN
      EQUIVALENCE (XNSEG(529), IT02Y )                                  MAIN
      EQUIVALENCE (XNSEG(530), IT03Y )                                  MAIN
      EQUIVALENCE (XNSEG(531), IT04Y )                                  MAIN
      EQUIVALENCE (XNSEG(532), IT05Y )                                  MAIN
      EQUIVALENCE (XNSEG(533), IT06Y )                                  MAIN
      EQUIVALENCE (XNSEG(534), IT02W )                                  MAIN
      EQUIVALENCE (XNSEG(535), IT04W )                                  MAIN
      EQUIVALENCE (XNSEG(536), FFRMIN)                                  MAIN
      EQUIVALENCE (XNSEG(537), FNMIN )                                  MAIN
      EQUIVALENCE   (XNSEG(79),CL      ),(XNSEG(85),DRT    )            MAIN
      EQUIVALENCE   (XNSEG(109),QS     ),(XNSEG(700),LOCCLA)            MAIN
      EQUIVALENCE   (XNSEG(697),ICLAX  ),(XNSEG(698),ICLAY )            MAIN
      EQUIVALENCE   (XNSEG(699),INDCLA ),(XNSEG(730),IEOP  )            MAIN
      EQUIVALENCE   (XNSEG(748),AMAXTJ ),(XNSEG(749),AMINRJ)            MAIN
      EQUIVALENCE   (XNSEG(731),INSCAL ),(XNSEG(751),FNFACT)            MAIN
      EQUIVALENCE   (XNSEG(752),LOCCLZ ),(XNSEG(753),INDCLZ )           MAIN
      EQUIVALENCE   (XNSEG(754),ICLZX  ),(XNSEG(755),ICLZY  )           MAIN
      EQUIVALENCE  (XNSEG(760),TMINTJ),(XNSEG(761),TMINRJ)              MAIN
      EQUIVALENCE  (XNSEG(762),ALPMAX)                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(2),DR)                                         MAIN
      EQUIVALENCE (ATMOS(14), TR)                                       MAIN
      INTEGER LOCTFF(21)                                                MAIN
      INTEGER CASEN, PSET                                               MAIN
      DATA  ITRLFT /10/                                                 MAIN
      ISVCEN = CASEN                                                    MAIN
      IF(CASEN.EQ.4) CALL ENCASE(AM,CASEN)                              MAIN
      IF(CASEN .EQ. 4  .AND.  PSET .EQ. 2)  RETURN                      MAIN
      E10=-.01                                                          MAIN
      E11=0.0                                                           MAIN
      FNREQ = PS                                                        MAIN
      IF(CASEN.EQ.5 )  GO TO 400                                        MAIN
      GO TO (100, 200, 300), CASEN                                      MAIN
C                                                                       MAIN
  100 CONTINUE                                                          MAIN
C     ...   ...   .....                                                 MAIN
C     CASEN 1     -DRY-                                                 MAIN
C                                                                       MAIN
      LOCTAB = LOCTFF(1)                                                MAIN
      IF(INDT01 .GT. 0)                                                 MAIN
     1CALL HIHO(3, LOCTAB, IT01X, IT01Y, 0, 0, H, AM, 0, 0, FN)         MAIN
      FNMAXD=FN*DR*TSIZEF*FLOAT(NUMENG)*TR                              MAIN
      IF(FNMAXD.LT.FNMIN)FNMAXD=FNMIN                                   MAIN
C                                                                       MAIN
      LOCTAB = LOCTFF(2)                                                MAIN
      LMIN = LOCTAB                                                     MAIN
      LMAX = LMIN +IT02X -1                                             MAIN
      IF(PSET .EQ. 1)  FNREQ = FNMAXD                                   MAIN
      IF(PSET .EQ. 2)  FNREQ = FNMAXD*TAB(LMIN)/100.0                   MAIN
      IF(PSET .EQ. 3)  FNREQ = FNMAXD*PS                                MAIN
      PS = FNREQ/FNMAXD                                                 MAIN
      PSD = PS*100.0                                                    MAIN
      IF(PSD.LT.TAB(LMIN))PSD=TAB(LMIN)                                 MAIN
      IF(PSD.GT.TAB(LMAX))PSD=TAB(LMAX)                                 MAIN
      IF(INDT02 .GT. 0)                                                 MAIN
     1CALL HIHO(4, LOCTAB, IT02X, IT02Y, IT02W, 0, PSD, AM, H, 0, FFD)  MAIN
      IF(INDT02.EQ.2)GO TO 101                                          MAIN
      FFR=FFD*TR**.5*FNMAXD*SFCFAC                                      MAIN
 102  IF(FFR.LT.FFRMIN)FFR=FFRMIN                                       MAIN
      FN = FNMAXD*PSD/100.0                                             MAIN
      IF(FN .LT. FNMIN)  FN = FNMIN                                     MAIN
      SFC = FFR/FN                                                      MAIN
      CASEN = ISVCEN                                                    MAIN
      RETURN                                                            MAIN
 101  FFR=FFD*DR*TR**1.5*TSIZEF*FLOAT(NUMENG)*SFCFAC                    MAIN
      GO TO 102                                                         MAIN
C                                                                       MAIN
  200 CONTINUE                                                          MAIN
C     ...   ...   .....                                                 MAIN
C     CASEN 2     -WET-                                                 MAIN
C                                                                       MAIN
      LOCTAB = LOCTFF(3)                                                MAIN
      IF(INDT03 .GT. 0)                                                 MAIN
     1CALL HIHO(3, LOCTAB, IT03X, IT03Y, 0, 0, H, AM, 0, 0, FN)         MAIN
      FNMAXW=FN*DR*TSIZEF*FLOAT(NUMENG)*TR                              MAIN
      IF(FNMAXW.LT.FNMIN)FNMAXW=FNMIN                                   MAIN
C                                                                       MAIN
      LOCTAB = LOCTFF(4)                                                MAIN
      LMIN = LOCTAB                                                     MAIN
      LMAX = LMIN +IT04X -1                                             MAIN
      IF(PSET .EQ. 1)  FNREQ = FNMAXW                                   MAIN
      IF(PSET .EQ. 2)  FNREQ = FNMAXW*TAB(LMIN)/100.0                   MAIN
      IF(PSET .EQ. 3)  FNREQ = FNMAXW*PS                                MAIN
      PS = FNREQ/FNMAXW                                                 MAIN
      PSW = PS*100.0                                                    MAIN
      IF(PSW.LT.TAB(LMIN))PSW=TAB(LMIN)                                 MAIN
      IF(PSW.GT.TAB(LMAX))PSW=TAB(LMAX)                                 MAIN
      IF(INDT04 .GT. 0)                                                 MAIN
     1CALL HIHO(4, LOCTAB, IT04X, IT04Y, IT04W, 0, PSW, AM, H, 0, FFW)  MAIN
      IF(INDT04.EQ.2)GO TO 201                                          MAIN
      FFR=FFW*TR**.5*FNMAXW*SFCFAC                                      MAIN
 202  IF(FFR.LT.FFRMIN)FFR=FFRMIN                                       MAIN
      FN = FNMAXW*PSW/100.0                                             MAIN
      IF(FN .LT. FNMIN)  FN = FNMIN                                     MAIN
      SFC = FFR/FN                                                      MAIN
      CASEN = ISVCEN                                                    MAIN
      RETURN                                                            MAIN
 201  FFR=FFW*DR*TR**1.5*SFCFAC*TSIZEF*FLOAT(NUMENG)                    MAIN
      GO TO 202                                                         MAIN
C                                                                       MAIN
  300 CONTINUE                                                          MAIN
C     ...   ...   ...........                                           MAIN
C     CASEN 3     -MAX POWER-                                           MAIN
C                                                                       MAIN
      PSP = 1.0                                                         MAIN
      PS = 1.0                                                          MAIN
      LOCTAB = LOCTFF(5)                                                MAIN
      IF(INDT05 .GT. 0)                                                 MAIN
     1CALL HIHO(3, LOCTAB, IT05X, IT05Y, 0, 0, H, AM, 0, 0, FN)         MAIN
      FNMAXP=FN*DR*TSIZEF*FLOAT(NUMENG)*TR                              MAIN
      IF(FNMAXP.LT.FNMIN)FNMAXP=FNMIN                                   MAIN
      LOCTAB = LOCTFF(6)                                                MAIN
      IF(INDT06 .GT. 0)                                                 MAIN
     1CALL HIHO(3, LOCTAB, IT06X, IT06Y, 0, 0, H, AM, 0, 0, FFP)        MAIN
      IF(INDT06.EQ.2)GO TO 301                                          MAIN
      FFR=FFP*TR**.5*FNMAXP*SFCFAC                                      MAIN
 302  IF(FFR.LT.FFRMIN)FFR=FFRMIN                                       MAIN
      FN = FNMAXP                                                       MAIN
      IF(FN .LT. FNMIN)  FN = FNMIN                                     MAIN
      SFC = FFR/FN                                                      MAIN
      CASEN = ISVCEN                                                    MAIN
      RETURN                                                            MAIN
 301  FFR=FFP*DR*TR**1.5*SFCFAC*TSIZEF*FLOAT(NUMENG)                    MAIN
      GO TO 302                                                         MAIN
C     DUAL ENGINE OPTION                                                MAIN
  400 CONTINUE                                                          MAIN
C     FNET = F-REQUIRED                                                 MAIN
      INTSET = 0                                                        MAIN
C     MIN THROTTLE                                                      MAIN
      IF(PSET.EQ.2 )  INTSET = -1                                       MAIN
      TSETTJ = TMINTJ                                                   MAIN
      TSETRJ = TMINRJ                                                   MAIN
C     MAX THROTTLE                                                      MAIN
      IF(PSET.EQ.1 ) INTSET = 1                                         MAIN
      IF(PSET.NE.3) GO TO 401                                           MAIN
      TSETTJ = PS                                                       MAIN
      TSETRJ = PS                                                       MAIN
      INTSET = -1                                                       MAIN
  401 CONTINUE                                                          MAIN
      IOP = IEOP                                                        MAIN
      IF(INSCAL.NE.0)  GO TO 420                                        MAIN
C     TJ ONLY                                                           MAIN
      IOP = 1                                                           MAIN
C     DUAL ENGINE OPTION                                                MAIN
      IF(AM.GT.AMINRJ)  IOP = 2                                         MAIN
C     RJ ONLY                                                           MAIN
      IF(AM.GT.AMAXTJ)  IOP = 3                                         MAIN
  415 CONTINUE                                                          MAIN
  420 CONTINUE                                                          MAIN
      ALPHA = 0.                                                        MAIN
      ITER = 0                                                          MAIN
      FT = FLOAT(NUMENG)                                                MAIN
      DRTZ = DRT                                                        MAIN
      PSZ = PS                                                          MAIN
      XLMAX = CL*QS                                                     MAIN
C      ITERATE TO ZERO OUT EXCESS LIFT IF THROTTLING NOT SPECIFIED      MAIN
  430 CONTINUE                                                          MAIN
      FREQ = PS/FT                                                      MAIN
C     COMPUTE LIFT SLOPE                                                MAIN
C     DETERMINE CL AT ALPHA = 0.                                        MAIN
      CLZ = 0.                                                          MAIN
      IF(INDCLZ.EQ.0) GO TO 431                                         MAIN
      CALL HIHO(3,LOCCLZ,ICLZX,ICLZY,0,0,AM,H,0,0,CLZ )                 MAIN
  431 CONTINUE                                                          MAIN
      IF(INDCLA.LE.0)  GO TO 435                                        MAIN
      CALL HIHO(3,LOCCLA,ICLAX,ICLAY,0,0,AM,H,0,0,DCLDA )               MAIN
      IF(DCLDA.LT.1.0E-06 )  GO TO 435                                  MAIN
      ALPHA = ( CL - CLZ)/DCLDA                                         MAIN
      IRTN = 0                                                          MAIN
      IF(ALPHA.LE.ALPMAX) GO TO 435                                     MAIN
      IRTN = 1                                                          MAIN
      WRITE (6,436) ALPHA,ALPMAX                                        MAIN
      ALPHA = ALPMAX                                                    MAIN
  436 FORMAT(1H0,10X,*^^^^^  ANGLE OF ATTACK TOO BIG, = *,E10.2,*  SET =MAIN
     1 *,E10.2,*  NO ITERATION ON EXCESS LIFT PERFORMED *)              MAIN
  435 ITER = ITER + 1                                                   MAIN
      IPFENG = 0                                                        MAIN
      CALL ENGINS (IOP,TSETTJ,TSETRJ,FAVTOT,WFTOT,ENLIFT,INTSET         MAIN
     *,FREQ,ALPHA,IPFENG )                                              MAIN
      IF(FAVTOT.LT.0.01)  GO TO 475                                     MAIN
      IF(IRTN.EQ.1) GO TO 475                                           MAIN
      IF( (INTSET.NE.0) .OR. (INDCLA.LE.0) ) GO TO 475                  MAIN
      IF( (INSCAL.LT.3) .OR. (INSCAL.EQ.5) )  GO TO 475                 MAIN
      IF(ITER.GT.1)  GO TO 440                                          MAIN
      CLLAST = CL                                                       MAIN
      DELCL = -ENLIFT/QS                                                MAIN
      EXLIFT = ENLIFT                                                   MAIN
      CL = CL + DELCL                                                   MAIN
      EXLLST = ENLIFT                                                   MAIN
      CALL DRAG                                                         MAIN
      PS = PSZ - ( DRTZ - DRT )                                         MAIN
      GO TO 430                                                         MAIN
  440 IF(ITER.LE.ITRLFT)  GO TO 445                                     MAIN
      WRITE (6,441)  EXLIFT                                             MAIN
  441 FORMAT(1H0,10X,* ITERATION COUNT EXCEEDED IN ENDAT.  EXCESS LIFT  MAIN
     *=*,E10.2 )                                                        MAIN
      GO TO 475                                                         MAIN
  445 IF(ABS(EXLIFT).LE. 0.001*XLMAX )  GO TO 475                       MAIN
      EXLIFT = CL*QS + ENLIFT - XLMAX                                   MAIN
      EXLDOT = (EXLIFT - EXLLST) / ( CL - CLLAST)                       MAIN
      CLLAST = CL                                                       MAIN
      EXLLST = EXLIFT                                                   MAIN
      DELCL = - EXLIFT/EXLDOT                                           MAIN
      CL = CL + DELCL                                                   MAIN
      CALL DRAG                                                         MAIN
      PS = PSZ - ( DRTZ - DRT )                                         MAIN
      GO TO 430                                                         MAIN
  475 CONTINUE                                                          MAIN
      IF( INSCAL.NE.3 ) GO TO 480                                       MAIN
      IPFENG = 1                                                        MAIN
      CALL ENGINS (IOP,TSETTJ,TSETRJ,FAVTOT,WFTOT,ENLIFT,INTSET         MAIN
     *,FREQ,ALPHA,IPFENG )                                              MAIN
  480 CONTINUE                                                          MAIN
      FN = FAVTOT*FT                                                    MAIN
      FFR = WFTOT*FT*3600.0                                             MAIN
      SFC=0.0                                                           MAIN
      IF(ABS(FN).GT.0.001)  SFC=FFR/FN                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX17                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HCOMPUTE,J0001)                                    MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HCOMBAT,J0002)                                     MAIN
      GO TO (90002,120), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 3.0                                                        MAIN
      GO TO 10                                                          MAIN
  120 CONTINUE                                                          MAIN
      TYPE = 2.0                                                        MAIN
      TERM(5) = 1.0                                                     MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HWARM-UP,J0003)                                    MAIN
      GO TO (90003,500),J0003                                           MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIFRC(8,8HTAKE-OFF,J0004)                                   MAIN
      GO TO (90004,500),J0004                                           MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      TERM(5) = 2.0                                                     MAIN
      GO TO 10                                                          MAIN
  500 CONTINUE                                                          MAIN
C     REQUEST LANDING CALC                                              MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HLANDING,JMP)                                      MAIN
      GO TO (501,10),JMP                                                MAIN
  501 TYPE=4.0                                                          MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0005)                                     MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0007)                                          MAIN
      GO TO (90007,200), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      TYPE = 1.0                                                        MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HTIME,J0008)                                       MAIN
      GO TO (90008,300), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0009)                                          MAIN
      GO TO (90009,300), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0010)                                          MAIN
      GO TO (90010,300), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
  300 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HDEG,J0011)                                        MAIN
      GO TO (90011,400), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIFRC(6,6HGTURNS,J0012)                                     MAIN
      GO TO (90012,400), J0012                                          MAIN
90012 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      CALL FILBCD(LX, X, Z)                                             MAIN
      CALL BCDDEC(Z, LX, TERM(3))                                       MAIN
  400 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FILLPM                                                 MAIN
      COMMON/COMTAB/C(3000)                                             MAIN
      COMMON/COMSEG/  XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(175), INDATM)                                  MAIN
      EQUIVALENCE(XNSEG(237),ITZ),(XNSEG(359),LOCTZ)                    MAIN
      EQUIVALENCE(XNSEG(730),IOP),(XNSEG(699),INDCLA)                   MAIN
      EQUIVALENCE(XNSEG( 98),PSET)                                      MAIN
      EQUIVALENCE (XNSEG(363), IPATMD)                                  MAIN
      EQUIVALENCE (XNSEG(364), HG    )                                  MAIN
      EQUIVALENCE (XNSEG(389), TM    )                                  MAIN
      EQUIVALENCE (XNSEG(414), PM    )                                  MAIN
      EQUIVALENCE (XNSEG(439), NHG   )                                  MAIN
      EQUIVALENCE (XNSEG(597), WL    )                                  MAIN
      EQUIVALENCE (XNSEG(604), FNL   )                                  MAIN
      EQUIVALENCE (XNSEG(605), W0    )                                  MAIN
      EQUIVALENCE (XNSEG(606), FN0   )                                  MAIN
      EQUIVALENCE (XNSEG(607), XIS0  )                                  MAIN
      EQUIVALENCE(XNSEG(756),IENFLG)                                    MAIN
      INTEGER XNSEG                                                     MAIN
      LOGICAL IPATMD                                                    MAIN
      INTEGER  CASEN,PSET                                               MAIN
      REAL HG(25), TM(25), PM(25), A(10)                                MAIN
      LOGICAL LOAD                                                      MAIN
      DATA LOAD /.TRUE./                                                MAIN
      IF(XNSEG(363) .EQ. 1)  IPATMD = .TRUE.                            MAIN
      IF(INDATM .NE. 9)   GO TO 20                                      MAIN
      IPATMD = .FALSE.                                                  MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 1) (HG(I), TM(I), PM(I), I=1,NHG)                        MAIN
    1 FORMAT(1H , 25H SUBROUTINE FILLPM (PRE) /                         MAIN
     1       1H0, 13X, 2HHG, 13X, 2HTM, 13X, 2HPM/(1X, 3G15.7))         MAIN
      NHGM1 = NHG -1                                                    MAIN
      DO 10 I=1,NHGM1                                                   MAIN
      IF(HG(I+1) .LE. HG(I))  GO TO 11                                  MAIN
      IF(PM(I+1) .GT. 0.0)  GO TO 10                                    MAIN
      A(3) = HG(I+1)                                                    MAIN
      CALL ATMOS9(A)                                                    MAIN
      PM(I+1) = A(4)                                                    MAIN
   10 CONTINUE                                                          MAIN
      WRITE(6, 2) (HG(I), TM(I), PM(I), I=1,NHG)                        MAIN
    2 FORMAT(1H0, 25H SUBROUTINE FILLPM (POST)/                         MAIN
     1       1H0, 13X, 2HHG, 13X, 2HTM, 13X, 2HPM/(1X, 3G15.7))         MAIN
      IPATMD = .TRUE.                                                   MAIN
      GO TO 20                                                          MAIN
   11 CONTINUE                                                          MAIN
      INDATM = 1                                                        MAIN
      WRITE(6, 12)                                                      MAIN
   12 FORMAT(45H HG NOT IN ASENDING ORDER ... INDATM SET TO 1)          MAIN
C                                                                       MAIN
   20 CONTINUE                                                          MAIN
      CALL ENSET                                                        MAIN
      IF(LOAD)  RETURN                                                  MAIN
      CALL ATMOSD                                                       MAIN
      CALL BERAN                                                        MAIN
      CALL CMAX                                                         MAIN
      CALL CHECK                                                        MAIN
      CALL CRCOMP                                                       MAIN
      CALL CLIMB                                                        MAIN
      CALL EMAX                                                         MAIN
      CALL PATH                                                         MAIN
      CALL RFMAX                                                        MAIN
      CALL RUN                                                          MAIN
      CALL TOP                                                          MAIN
      CALL VMAX                                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX13                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0004)                                   MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT (1,LC,C)                                              MAIN
      CALL QXICOL (1,0,1)                                               MAIN
      CALL QXIFRC (7,7HWEIGHT=,JMP)                                     MAIN
      GO TO (210,300),JMP                                               MAIN
  210 CALL QXIFRC(1,1H,,JMP)                                            MAIN
      GO TO(215,300),JMP                                                MAIN
  215 CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET (LA,A,8,1HA)                                          MAIN
      CALL QXIGET (LV,V,2,1HV)                                          MAIN
      CALL QXIGET (LX,X,8,1HX)                                          MAIN
      CALL FILBCD (LV,V,Z)                                              MAIN
      CALL BCDDEC (Z,LV,TERM(3) )                                       MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX13(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 13... ALTITUDE, MACH, AND/OR WEIGHT CHANGE OR              MAIN
C     INITIALIZATION                                                    MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      IF ( TZ(ITZ).NE. 0.) AM = TZ(ITZ)                                 MAIN
      IF ( TZ(ITZ+1) .NE. 0.)  H = TZ(ITZ+1)                            MAIN
      IF ( TZ(ITZ+2) .NE. 0.)  WT = TZ(ITZ+2)                           MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE AHMACH(Z, NX, NY)                                      MAIN
      REAL Z(1)                                                         MAIN
      WRITE(6, 1) (Z(I+NX), I=1,NY)                                     MAIN
    1 FORMAT(1H0, 44X, 11HMACH NUMBER/ 13H ALTITUDE    9(7X, F5.3))     MAIN
      NJ = NY*NX                                                        MAIN
      DO 100 I=1,NX                                                     MAIN
      H = Z(I)                                                          MAIN
      K = I +NX +NY -1                                                  MAIN
      WRITE(6, 2) Z(I), (Z(K+J), J=1,NJ,NX)                             MAIN
    2 FORMAT(1X, F12.0, 9(1X, F11.3))                                   MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ASCALE(Z, NX, NY)                                      MAIN
      REAL Z(1)                                                         MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(2),DR)                                         MAIN
      EQUIVALENCE (ATMOS(14),TR)                                        MAIN
      DO 100 I=1,NX                                                     MAIN
      H = Z(I)                                                          MAIN
      CALL ATMOSD                                                       MAIN
      DRTR=DR*TR                                                        MAIN
      K = I +NX +NY                                                     MAIN
      DO 50 J=1,NY                                                      MAIN
      Z(K)=Z(K)/DRTR                                                    MAIN
      K = K +NX                                                         MAIN
   50 CONTINUE                                                          MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ASRCH (LOC1,SYM1)                                      MAIN
      COMMON /TABNAM/ MAXT, STABLE(126), LOCS(126), IS(126)             MAIN
      DATA BLANK / 1H  /                                                MAIN
      DO 2000 I=1,MAXT                                                  MAIN
      IF (LOC1 .NE. LOCS(I) ) GO TO 2000                                MAIN
      SYM1 = STABLE(I)                                                  MAIN
      RETURN                                                            MAIN
 2000 CONTINUE                                                          MAIN
      SYM1 = BLANK                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATJAN6(Z,ZMAX,ANSW, DTDH)                              MAIN
C                             1966 JANUARY ATMOSPHERE,30DEG.N.L.        MAIN
      DIMENSION HB(30),PB(30),TB(30),WTMOLB(30),ANSW(8),TMB(30)         MAIN
C     BASE  LAYER GEOPOTENTIAL ALTITUDE BREAK POINTS                    MAIN
      DATA HB /-5000.0,0.0,2000.0,12000.0,17000.0,                      MAIN
     A18000.0,22000.0,32000.0,47000.0,51000.0,59000.0,79000.0,          MAIN
     B88000.0,100000.0,110000.0,116000.0,120000.0,130000.0,1            MAIN
     C50000.0,160000.0,180000.0,200000.0,220000.0,240000.0,260          MAIN
     D000.0,280000.0,320000.0,400000.0,500000.0,1000000.0/              MAIN
C     BASE LAYER MOLECULAR WEIGHT VALUES                                MAIN
      DATA WTMOLB /28.9644,28.9644,                                     MAIN
     X28.9644,28.9644,28.9644,28.964                                    MAIN
     A4,28.9644,28.9644,28.9644,28.9644,28.9644,28.9644,28.9644,28.805,2MAIN
     B8.646,27.366,27.12,26.54,25.58,25.15,24.33,23.55,22.79,22.07,21.39MAIN
     C,20.73,19.54,17.70,16.19,6.23/                                    MAIN
C     BASE LAYER TEMPERATURE IN DEGREES KELVIN                          MAIN
      DATA TB /320.65,288.52,281.86,216.15,203.15,203.15,213.           MAIN
     *15,233.15,269.15,269.15,253.15,191.15,191.03,227.07,276.22,321.23,MAIN
     *333.2,506.7,757.8,852.5,998.6,1103.5,1179.8,1239.0,1266.5,1279.2,1MAIN
     *292.0,1298.8,1299.9,1300.0/                                       MAIN
C     LAYER PRESSURE IN MILLIBARS                                       MAIN
      DATA PB /1.77687E3,1.02100E3,8.035E2,2.019E2,8.937E1,             MAIN
     *7.553E1,3.917E1,8.465,1.096,6.599E-1,2.316E-1,1.048E-2,2.098E-3,  MAIN
     *3.018E-4,8.150E-5,4.258E-5,3.637E-5,1.752E-5,6.900E-6,4.843E-6,2.6MAIN
     *66E-6,1.608E-6,1.027E-6,6.836E-7,4.685E-7,3.272E-7,1.669E-7,4.977EMAIN
     *-8,1.306E-8,1.856E-10/                                            MAIN
C     RADIUS OF EARTH AT 30 DEG.N.LAT. IN METERS                        MAIN
      RAD30=6345653.0                                                   MAIN
C     SEA LEVEL ACCELERATION DUE TO GRAVITY(GSL) IN METERS/SECON        MAIN
      GSL=9.80665                                                       MAIN
C     SEA LEVEL ACCELERATION DUE TO GRAVITY IN M/SEC FOR 30DEG.N        MAIN
      GSL30=9.79324                                                     MAIN
C     GEOMETRIC ALTITUDE IN METERS ,Z                                   MAIN
C     MAXIMUM ALTITUDE(ZMAX)                                            MAIN
C     TEST FOR A ARRAY(67) ZERO IMPUT                                   MAIN
      IF(ZMAX.EQ.0.)GO TO 14                                            MAIN
      IF(Z-ZMAX.GT.0.)GO TO 333                                         MAIN
   14 CONTINUE                                                          MAIN
C     CALCULATE GEOPOTENTIAL ALTITUDE(H) FROM GEOMETRIC ALTITUDE        MAIN
      H=(RAD30*Z*GSL30)/((RAD30+Z)*GSL)                                 MAIN
C     BRACKET INCOMING ALTITUDE BETWEEN TWO GEOPOTENTIAL ALTITUD        MAIN
      DO 15 N=1,29                                                      MAIN
      IF(H.GE.HB(N).AND.H.LT.HB(N+1))GO TO 16                           MAIN
   15 CONTINUE                                                          MAIN
   16 CONTINUE                                                          MAIN
      HDIFF=H-HB(N)                                                     MAIN
C     MEAN MOLECULAR WEIGHT OF AIR AT SEA LEVEL (DIMENSIONLESS)         MAIN
      WTMOLL=28.9644                                                    MAIN
C     UNIVERSAL GAS CONSTANT EQUALS 8.31432 JOULES/DEG,K*KG-MOL         MAIN
      GASCNT=8.31432E+3                                                 MAIN
C     CALCULATE MOLECULAR WEIGHT(WTMOL)                                 MAIN
      WTMOL=WTMOLB(N)+((WTMOLB(N+1)-WTMOLB(N))/(HB(N+1)-HB(N)))*(HDIFF) MAIN
C     CALCULATE TEMPERATURE IN DEGREES KELVIN(T)                        MAIN
      SLOPE=(TB(N+1)-TB(N))/(HB(N+1)-HB(N))                             MAIN
      T=TB(N)+SLOPE*HDIFF                                               MAIN
      DTDH = SLOPE/1.8                                                  MAIN
C     CALCULATE MOLECULAR SCALE BASE TEMPERATURES                       MAIN
      TMB(N)=TB(N)*WTMOLL/WTMOL                                         MAIN
      TMB(N+1)=TB(N+1)*WTMOLL/WTMOL                                     MAIN
C     CALCULATE MOLECULAR SCALE TEMPERATURE(TM) IN DEGREES KELVI        MAIN
      TM=T*WTMOLL/WTMOL                                                 MAIN
C     CALCULATE MOLECULAR SCALE TEMPERATURE GRADIENT                    MAIN
      TMSLOP=(TMB(N+1)-TMB(N))/(HB(N+1)-HB(N))                          MAIN
C     CALCULATE EXPONENT OF PRESSURE EQUATION                           MAIN
      PEXP=GSL30*WTMOL/(GASCNT*TMSLOP)                                  MAIN
C     CALCULATE PRESSURE(P) IN MILLIBARS                                MAIN
      IF(H.LT.120000.0)GO TO 41                                         MAIN
C     CALCULATE PRESSURE(P) AT ALTITUDES ABOVE 120000METERS             MAIN
      P=PB(N)+((PB(N+1)-PB(N))/(HB(N+1)-HB(N)))*HDIFF                   MAIN
      GO TO 43                                                          MAIN
   41 CONTINUE                                                          MAIN
      IF(TMB(N+1).EQ.TMB(N))GO TO 42                                    MAIN
C     CALCULATE PRESSURE(P) WHEN TMSLOP IS NOT EQUAL TO ZERO            MAIN
      P=PB(N)*(TMB(N)/(TMB(N)+TMSLOP*HDIFF))**PEXP                      MAIN
      GO TO 43                                                          MAIN
   42 CONTINUE                                                          MAIN
C     CALCULATE PRESSURE(P) WHEN TMSLOP IS EQUAL TO ZERO                MAIN
      P=PB(N)*EXP(-GSL30*WTMOL*HDIFF/(GASCNT*TMB(N)))                   MAIN
   43 CONTINUE                                                          MAIN
C     CALCULATE DENSITY(DNSITY) IN KG/CUBIC METERS                      MAIN
      DNSITY=((WTMOLL*P)/(GASCNT*TM))*100.                              MAIN
C     CALCULATE SPEED OF SOUND                                          MAIN
      IF(H.GT.90000.0)GO TO 44                                          MAIN
      CS=20.04680273*(TM)**.5                                           MAIN
      GO TO 46                                                          MAIN
   44 CS=282.2                                                          MAIN
   46 CONTINUE                                                          MAIN
C     CALCULATE ACCELERATION DUE TO GRAVITY                             MAIN
      GS=9.79324*(6345653.0)**2/((6345653.0+Z)**2)                      MAIN
C     COEFFICIENT OF VISCOSITY AS CALCULATED BY SUTHERLANDS FORM        MAIN
C     MU=B*T**1.5/(T+S)                                                 MAIN
C     SET VISCOSITY(VISCOS) TO A CONSTANT IF ALTITUDE EXCEEDS 90        MAIN
      IF(H.GT.90000.0)GO TO 47                                          MAIN
      B=1.458E-6                                                        MAIN
      S=110.4                                                           MAIN
      VISCOS=(B*T**1.5)/(T+S)                                           MAIN
      GO TO 48                                                          MAIN
   47 CONTINUE                                                          MAIN
      VISCOS=1.318E-5                                                   MAIN
   48 CONTINUE                                                          MAIN
      GO TO 334                                                         MAIN
C     ATMOSPHERIC RATIOS AND CONSTANTS IF ALTITUDE(Z) EXCEEDS MA        MAIN
C     ALTITUDE(ZMAX)                                                    MAIN
  333 ANSW(1)=0.                                                        MAIN
      ANSW(2)=0.                                                        MAIN
      ANSW(3)=0.                                                        MAIN
      ANSW(4)=0.8288                                                    MAIN
      ANSW(5)=0.                                                        MAIN
      ANSW(6)=0.                                                        MAIN
      ANSW(7)=0.                                                        MAIN
      ANSW(8)=0.                                                        MAIN
      DTDH = 0.0                                                        MAIN
      GO TO 500                                                         MAIN
  334 CONTINUE                                                          MAIN
C     PRESSURE RATIO(ANSW(1)),PRESSURE/SEA LEVEL PRESSURE               MAIN
      ANSW(1)=P/1021.0                                                  MAIN
C     KINETIC TEMP.RATIO(ANSW(2)),TEMPERATURE/SEA LEVEL TEMPERAT        MAIN
      ANSW(2)=T/288.52                                                  MAIN
C     DENSITY RATIO(ANSW(3)),DENSITY/SEA LEVEL DENSITY                  MAIN
      ANSW(3)=DNSITY/1.232785458                                        MAIN
C     SPEED OF SOUND RATIO(ANSW(4)),SPEED OF SOUND/SEA LEVEL SPE        MAIN
C     SOUND                                                             MAIN
      ANSW(4)=CS/340.512                                                MAIN
C     GRAVITATIONAL ACCELERATION RATIO(ANSW(5)),GRAVITY ACCELERA        MAIN
C     SEA LEVEL GRAVITY ACCELERATION                                    MAIN
      ANSW(5)=GS/GSL30                                                  MAIN
C     MOLECULAR TEMP. RATIO(ANSW(6)),MOLECULAR TEMP./SEA LEVEL M        MAIN
      ANSW(6)=TM/288.52                                                 MAIN
C     MOLECULAR WT.(ANSW(7))                                            MAIN
      ANSW(7)=WTMOL                                                     MAIN
C     VISCOSITY RATIO(ANSW(8),VISCOSITY/SEA LEVEL VISCOSITY             MAIN
      ANSW(8)=VISCOS/1.79116E-5                                         MAIN
  500 RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATJUL6(Z,ZMAX,ANSW, DTDH)                              MAIN
C                             1966 JULY  ATMOSPHERE,30DEG.N.L.          MAIN
      DIMENSION HB(30),PB(30),TB(30),WTMOLB(30),ANSW(8),TMB(30)         MAIN
C     BASE  LAYER GEOPOTENTIAL ALTITUDE BREAK POINTS IN METERS          MAIN
      DATA HB /-5000.0,0.0,1000.0,6000.0,15000.0                        MAIN
     A,16000.0,21000.0,32000.0,47000.0,51000.0,59000.0,810              MAIN
     B00.0,89000.0,100000.0,110000.0,116000.0,120000.0,130              MAIN
     C000.0,150000.0,160000.0,180000.0,200000.0,220000.0,2              MAIN
     D40000.0,260000.0,280000.0,320000.0,400000.0,500000.0              MAIN
     E,1000000.0/                                                       MAIN
C     BASE LAYER MOLECULAR WEIGHT VALUES                                MAIN
      DATA WTMOLB /28.9644,28.9644,28.9644,28.9644,                     MAIN
     A28.9644,28.9644,28.9644,28.9644,28.9644,28.9644,28.9              MAIN
     B644,28.9644,28.9644,28.88,28.56,28.27,26.76,26.20,25              MAIN
     C.33,24.95,24.21,23.49,22.78,22.07,21.39,20.73,19.54,              MAIN
     D17.70,16.19,6.23/                                                 MAIN
C     BASE LAYER TEMPERATURE IN DEGREES KELVIN                          MAIN
      DATA TB /320.65,304.58,295.58,266.44                              MAIN
     A,203.15,203.15,214.15,236.15,272.15,272.15,256.15,172.52,17       MAIN
     B2.34,192.85,266.40,355.92,379.7,594.8,889.2,986.3,11              MAIN
     C13.7,1186.7,1227.9,1249.1,1266.5,1279.2,1292.0,1298.              MAIN
     D8,1299.9,1300.0/                                                  MAIN
C     LAYER PRESSURE IN MILLIBARS                                       MAIN
      DATA PB /1.77687E+3,1.01350E+3,9.044E+2,4.9                       MAIN
     A20E+2,1.317E+2,1.113E+2,4.908E+1,9.236,1.226,7.418E-              MAIN
     B1,2.635E-1,7.555E-3,1.550E-3,2.043E-4,4.880E-5,2.627              MAIN
     CE-5,2.277E-5,1.223E-5,5.597E-6,4.142E-6,2.459E-6,1.5              MAIN
     D52E-6,1.017E-6,6.833E-7,4.685E-7,3.272E-7,1.669E-7,4              MAIN
     E.976E-8,1.306E-8,1.856E-10/                                       MAIN
C     RADIUS OF EARTH AT 30 DEG.N.LAT. IN METERS                        MAIN
      RAD30=6345653.0                                                   MAIN
C     SEA LEVEL ACCELERATION DUE TO GRAVITY(GSL) IN METERS/SECON        MAIN
      GSL=9.80665                                                       MAIN
C     SEA LEVEL ACCELERATION DUE TO GRAVITY IN M/SEC FOR 30DEG.N        MAIN
      GSL30=9.79324                                                     MAIN
C     GEOMETRIC ALTITUDE IN METERS ,Z                                   MAIN
C     MAXIMUM ALTITUDE(ZMAX)                                            MAIN
C     TEST FOR A ARRAY(67) ZERO IMPUT                                   MAIN
      IF(ZMAX.EQ.0.)GO TO 14                                            MAIN
      IF(Z-ZMAX.GT.0.)GO TO 333                                         MAIN
   14 CONTINUE                                                          MAIN
C     CALCULATE GEOPOTENTIAL ALTITUDE(H) FROM GEOMETRIC ALTITUDE        MAIN
      H=(RAD30*Z*GSL30)/((RAD30+Z)*GSL)                                 MAIN
C     BRACKET INCOMING ALTITUDE BETWEEN TWO GEOPOTENTIAL ALTITUD        MAIN
      DO 15 N=1,29                                                      MAIN
      IF(H.GE.HB(N).AND.H.LT.HB(N+1))GO TO 16                           MAIN
   15 CONTINUE                                                          MAIN
   16 CONTINUE                                                          MAIN
      HDIFF=H-HB(N)                                                     MAIN
C     MEAN MOLECULAR WEIGHT OF AIR AT SEA LEVEL (DIMENSIONLESS)         MAIN
      WTMOLL=28.9644                                                    MAIN
C     UNIVERSAL GAS CONSTANT EQUALS 8.31432 JOULES/DEG,K*KG-MOL         MAIN
      GASCNT=8.31432E3                                                  MAIN
C     CALCULATE MOLECULAR WEIGHT(WTMOL)                                 MAIN
      WTMOL=WTMOLB(N)+((WTMOLB(N+1)-WTMOLB(N))/(HB(N+1)-HB(N)))*(HDIFF) MAIN
C     CALCULATE TEMBERATURE IN DEGREES KELVIN(T)                        MAIN
      SLOPE=(TB(N+1)-TB(N))/(HB(N+1)-HB(N))                             MAIN
      T=TB(N)+SLOPE*HDIFF                                               MAIN
      DTDH = SLOPE/1.8                                                  MAIN
C     CALCULATE MOLECULAR SCALE BASE TEMPERATURES                       MAIN
      TMB(N)=TB(N)*WTMOLL/WTMOL                                         MAIN
      TMB(N+1)=TB(N+1)*WTMOLL/WTMOL                                     MAIN
C     CALCULATE MOLECULAR SCALE TEMPERATURE(TM) IN DEGREES KELVI        MAIN
      TM=T*WTMOLL/WTMOL                                                 MAIN
C     CALCULATE MOLECULAR SCALE TEMPERATURE GRADIENT                    MAIN
      TMSLOP=(TMB(N+1)-TMB(N))/(HB(N+1)-HB(N))                          MAIN
C     CALCULATE EXPONENT OF PRESSURE EQUATION                           MAIN
      PEXP=GSL30*WTMOL/(GASCNT*TMSLOP)                                  MAIN
C     CALCULATE PRESSURE(P) IN MILLIBARS                                MAIN
      IF(H.LT.120000.0)GO TO 41                                         MAIN
C     CALCULATE PRESSURE(P) AT ALTITUDES ABOVE 120000METERS             MAIN
      P=PB(N)+((PB(N+1)-PB(N))/(HB(N+1)-HB(N)))*HDIFF                   MAIN
      GO TO 43                                                          MAIN
   41 CONTINUE                                                          MAIN
      IF(TMB(N+1).EQ.TMB(N))GO TO 42                                    MAIN
C     CALCULATE PRESSURE(P) WHEN TMSLOP IS NOT EQUAL TO ZERO            MAIN
      P=PB(N)*(TMB(N)/(TMB(N)+TMSLOP*HDIFF))**PEXP                      MAIN
      GO TO 43                                                          MAIN
   42 CONTINUE                                                          MAIN
C     CALCULATE PRESSURE(P) WHEN TMSLOP IS EQUAL TO ZERO                MAIN
      P=PB(N)*EXP(-GSL30*WTMOL*HDIFF/(GASCNT*TMB(N)))                   MAIN
   43 CONTINUE                                                          MAIN
C     CALCULATE DENSITY(DNSITY) IN KG/CUBIC METERS                      MAIN
      DNSITY=((WTMOLL*P)/(GASCNT*TM))*100.                              MAIN
C     CALCULATE SPEED OF SOUND                                          MAIN
       IF(H.GT.90000.0)GO TO 44                                         MAIN
                                                                        MAIN
      CS=20.04680273*(TM)**.5                                           MAIN
      GO TO 46                                                          MAIN
   44 CS=265.2                                                          MAIN
   46 CONTINUE                                                          MAIN
C     CALCULATE ACCELERATION DUE TO GRAVITY                             MAIN
      GS=9.79324*(6345653.0)**2/((6345653.0+Z)**2)                      MAIN
C     COEFFICIENT OF VISCOSITY AS CALCULATED BY SUTHERLANDS FORM        MAIN
C     MU=B*T**1.5/(T+S)                                                 MAIN
C     SET VISCOSITY(VISCOS) TO A CONSTANT IF ALTITUDE EXCEEDS 90        MAIN
      IF(H.GT.90000.0)GO TO 47                                          MAIN
      B=1.458E-6                                                        MAIN
      S=110.4                                                           MAIN
      VISCOS=(B*T**1.5)/(T+S)                                           MAIN
      GO TO 48                                                          MAIN
   47 CONTINUE                                                          MAIN
      VISCOS=1.318E-5                                                   MAIN
   48 CONTINUE                                                          MAIN
      GO TO 334                                                         MAIN
  333 ANSW(1)=0.                                                        MAIN
      ANSW(2)=0.                                                        MAIN
      ANSW(3)=0.                                                        MAIN
      ANSW(4)=0.7579                                                    MAIN
      ANSW(5)=0.                                                        MAIN
      ANSW(8)=0.                                                        MAIN
      ANSW(7)=0.                                                        MAIN
      ANSW(6)=0.                                                        MAIN
      DTDH = 0.0                                                        MAIN
      GO TO 500                                                         MAIN
  334 CONTINUE                                                          MAIN
C     PRESSURE RATIO(ANSW(1)),PRESSURE/SEA LEVEL PRESSURE               MAIN
       ANSW(1)=P/1013.5                                                 MAIN
C     KINETIC TEMP.RATIO(ANSW(2)),TEMPERATURE/SEA LEVEL TEMPERAT        MAIN
      ANSW(2)=T/304.58                                                  MAIN
C     DENSITY RATIO(ANSW(3)),DENSITY/SEA LEVEL DENSITY                  MAIN
      ANSW(3)=DNSITY/1.15920862                                         MAIN
C     SPEED OF SOUND RATIO(ANSW(4)),SPEED OF SOUND/SEA LEVEL SPE        MAIN
C     SOUND                                                             MAIN
      ANSW(4)=CS/349.861                                                MAIN
C     GRAVITATIONAL ACCELERATION RATIO(ANSW(5)),GRAVITY ACCELERA        MAIN
C     SEA LEVEL GRAVITY ACCELERATION                                    MAIN
      ANSW(5)=GS/GSL30                                                  MAIN
C     MOLECULAR TEMP. RATIO(ANSW(6)),MOLECULAR TEMP./SEA LEVEL M        MAIN
      ANSW(6)=TM/304.58                                                 MAIN
C     MOLECULAR WT.(ANSW(7))                                            MAIN
      ANSW(7)=WTMOL                                                     MAIN
C     VISCOSITY RATIO(ANSW(8),VISCOSITY/SEA LEVEL VISCOSITY             MAIN
      ANSW(8)=VISCOS/1.86759E-5                                         MAIN
  500 RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOSD                                                 MAIN
      COMMON /COMSEG/ XNSEG(500)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(175), INDATM)                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(177), DR    )                                  MAIN
      EQUIVALENCE (XNSEG(178), DTRDH )                                  MAIN
      EQUIVALENCE (XNSEG(179), DPRDH )                                  MAIN
      EQUIVALENCE (XNSEG(180), PR    )                                  MAIN
      EQUIVALENCE (XNSEG(181), PRES  )                                  MAIN
      EQUIVALENCE (XNSEG(182), PTOT  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(185), REYFT )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(188), TEMP  )                                  MAIN
      EQUIVALENCE (XNSEG(189), TR    )                                  MAIN
      EQUIVALENCE (XNSEG(190), TTOT  )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(192), VELA  )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(363), IPATMD)                                  MAIN
      LOGICAL IPATMD                                                    MAIN
      REAL ATMOS(20)                                                    MAIN
      LOGICAL MGIVEN                                                    MAIN
      REAL A(10)                                                        MAIN
      DATA G0 /-32.1740484/                                             MAIN
      DATA R0 /20890855.0/                                              MAIN
      DATA R30 /20820087.493/                                           MAIN
      DATA G30 /-32.13262044/                                           MAIN
      ENTRY      ALTA                                                   MAIN
      ZMAX=700000.0                                                     MAIN
      Z = 0.3048*H                                                      MAIN
      IF(INDATM .EQ. 9)  GO TO 900                                      MAIN
  300 CONTINUE                                                          MAIN
      CALL ATMOS3(H, DR, TR, PR, DTRDH, DPRDH)                          MAIN
      PRES=PR*2116.22                                                   MAIN
      RHO=DR*2.37688E-03                                                MAIN
      TEMP=TR*518.67                                                    MAIN
      ASPEED=1116.45*TR**0.5                                            MAIN
      DTDH = DTRDH*518.67                                               MAIN
      DPDH = DPRDH*2116.22                                              MAIN
      VR=(0.226968E-07*TEMP**1.5)/(TEMP+198.72)                         MAIN
      GO TO 1000                                                        MAIN
  900 CONTINUE                                                          MAIN
      A(3) = H                                                          MAIN
      CALL ATMOS9(A)                                                    MAIN
      TR = A(8)/518.67                                                  MAIN
      PR = A(4)/2116.22                                                 MAIN
      DTDH = A(9)                                                       MAIN
      DPDH = A(5)                                                       MAIN
      DR = PR/TR                                                        MAIN
      PRES = A(4)                                                       MAIN
      RHO = A(6)                                                        MAIN
      TEMP = A(8)                                                       MAIN
      ASPEED = A(1)                                                     MAIN
      DTRDH = DTDH/518.67                                               MAIN
      DPRDH = DPDH/2116.22                                              MAIN
      VR=(0.226968E-07*TEMP**1.5)/(TEMP+198.72)                         MAIN
      GO TO 1000                                                        MAIN
C                                                                       MAIN
 1000 CONTINUE                                                          MAIN
      IF(IPATMD)  WRITE(6, 1001)                                        MAIN
     1            H, TR, PR, DR, DPDH, DTDH, TEMP, ASPEED, RHO, PRES, VRMAIN
 1001 FORMAT(1X, G9.2, F7.4, 4G13.5, 2F8.2, 3G13.5)                     MAIN
C                                                                       MAIN
C     TR       TEMPERATURE RATIO                                        MAIN
C     PR       PRESSURE RATIO                                           MAIN
C     DR       DENSITY RATIO                                            MAIN
C     TEMP     TEMPERATURE  (DEG R)                                     MAIN
C     ASPEED   SPEED OF SOUND  (FT/SEC)                                 MAIN
C     RHO      DENSITY  (SLUGS/CUBIC FT.)                               MAIN
C     PRES     PRESSURE  (POUNDS/SQ. FT.)                               MAIN
C     VELA     SPEED OF SOUND  (KNOTS)                                  MAIN
C     Q        DYNAMIC PRESSURE  (POUNDS/SQ. FT.)                       MAIN
C     PTOT     TOTAL PRESSURE  (POUNDS/SQ. FT.)                         MAIN
C     VEL      VELOCITY  (KNOTS)                                        MAIN
C     SPEED    VEHICLE SPEED  (FT/SEC)                                  MAIN
C                                                                       MAIN
      QMSQR=1481.344*PR                                                 MAIN
      VELA = ASPEED*0.5921                                              MAIN
      RLM=RHO*ASPEED/VR                                                 MAIN
      IF(MGIVEN)  VEL = AM*VELA                                         MAIN
      IF(.NOT. MGIVEN)  AM = VEL/VELA                                   MAIN
      SPEED=AM*ASPEED                                                   MAIN
      Q=QMSQR*AM**2                                                     MAIN
      PTOT=PRES+Q                                                       MAIN
      REYFT=RLM*AM                                                      MAIN
      TTOT=TEMP*(1.0+0.205*(AM**2))                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOS3(H, DR, TR, PR, DTDH, DPDH)                      MAIN
C     US STANDARD ATMOSPHERE, 1962     (6/3/70  CJF + GAT)              MAIN
C     TAKEN FROM THE ORIGINAL NSEG PROGRAM                              MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              PROVIDES ATMOSPHERIC AND GAS DYNAMIC PROPERTIES FOR      MAIN
C                  GIVEN ALTITUDE AND MACH NUMBER                       MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      IF(H .GE. 36089.2)  GO TO 3                                       MAIN
C                                                                       MAIN
C                  GOOD FOR SEA LEVEL TO 36089.2 FEET                   MAIN
      TR=1.0-6.87528E-06*H                                              MAIN
      PR=TR**5.256152                                                   MAIN
      DTDH=-6.87528E-06                                                 MAIN
      DPDH=-3.61375E-05*TR**4.256152                                    MAIN
      DR = PR/TR                                                        MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
    3 CONTINUE                                                          MAIN
      IF(H .GE. 65616.8)  GO TO 5                                       MAIN
C                                                                       MAIN
C                GOOD FROM 36089.2 TO 65616.8 FEET                      MAIN
      TR=0.751865                                                       MAIN
      PR=0.223361/EXP((H-36089.2)*4.80637E-05)                          MAIN
      DTDH=0.0                                                          MAIN
      DPDH=-4.80637E-05*PR                                              MAIN
      DR = PR/TR                                                        MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
    5 CONTINUE                                                          MAIN
C                GOOD FROM 65616.8 TO 105000 FEET                       MAIN
      TR = 0.10578E-05*(H-65616.798) + 0.751865                         MAIN
      PRA=0.751865/TR                                                   MAIN
      PR=0.0540328*PRA**34.203357                                       MAIN
      DTDH=0.105655E-05                                                 MAIN
      DPDH=-0.259702E-05*PRA**35.203357                                 MAIN
      DR = PR/TR                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOS1(A)                                              MAIN
C     THIS ROUTINE WAS TAKEN FROM THE HYPERSONIC ARBITRARY-BODY         MAIN
C              AERODYNAMIC COMPUTER PROGRAM MARK III VERSION            MAIN
C              SEE DOUGLAS REPORT DAC61552 BY ARVEL E. GENTRY           MAIN
C     THIS ROUTINE CALCULATES ATMOSPHERIC PROPERTIES OF THE             MAIN
C     US STANDARD ATMOSPHERE,1962,ASSUMING AN INVERSE SQUARE            MAIN
C     GRAVITATIONAL FIELD. THIS ASSUMPTION YIELDS DATA THAT             MAIN
C     AGREES WITH THE COESA DOCUMENT WITHIN 1 PER CENT AT               MAIN
C     ALL ALTITUDES UP TO 700 KILOMETERS (2296588 FEET). THE            MAIN
C     DATA IS ARRANGED IN THE ATMOSPHERE ARRAY, A, AS                   MAIN
C     FOLLOWS                                                           MAIN
C     A(1)  = CS, SPEED OF SOUND, FT/SEC                                MAIN
C     A(2)  = (1/CS)(DCS/DZ), SOUND DERIVATIVE, 1/FT                    MAIN
C     A(3)  = Z, GEOMETRIC ALTITUDE, FT (GIVEN)                         MAIN
C     A(4)  = P, PRESSURE, LB/FT2                                       MAIN
C     A(5)  = DP/DZ, PRESSURE DERIVATIVE, LB/FT3                        MAIN
C     A(6)  = RHO, DENSITY, SLUGS/FT3                                   MAIN
C     A(7)  = (1/RHO)(DRHO/DZ), DENSITY DERIVATIVE, 1/FT                MAIN
C     A(8)  = T, TEMPERATURE, DEG RANKINE                               MAIN
C     A(9)  = DT/DZ, TEMPERATURE DERIVATIVE, DEG RANKINE/FT             MAIN
C     VARIOUS CONSTANTS USED                                            MAIN
C      EARTH RADIUS                = 20890855 FT                        MAIN
C      SPECIFIC HEAT RATIO FOR AIR = 1.4                                MAIN
C     SEA LEVEL VALUES                                                  MAIN
C      GRAVITATIONAL ACCELERATION  = 32.1740484 FT/SEC2                 MAIN
C      MOLECULAR WEIGHT            = 28.9644                            MAIN
C      G0*M0/R*                    = 0.018743418 DEG RANK/FT            MAIN
      DIMENSION  A( 9),HG(10),ZM(14),WM(14),TM(23),PM(22)               MAIN
C     SET ARRAYS AND CONSTANT VALUES                                    MAIN
      DATA G0,WM0,R0,GMRS/32.1740484,28.9644,20890855.0,                MAIN
     1     0.018743418/,HG/-16404.,0.0                                  MAIN
     2     ,36089.,65617.,104987.,154199.,170604.,200131.,              MAIN
     3     259186.,291160./,ZM/295276.,328084.,                         MAIN
     4     360892.,393701.,492126.,524934.,557743.,623360.,             MAIN
     5     754593.,984252.,1312336.,1640420.,1968504.,                  MAIN
     6     2296588./,WM/28.9644,28.88,28.56,                            MAIN
     7     28.07,26.92,26.66,26.4,25.85,24.7,22.66,19.94,               MAIN
     8     17.94,16.84,16.17/                                           MAIN
      DATA TM/577.17,518.67,389.97,389.97,411.57                        MAIN
     1     ,487.17,487.17,454.77,325.17,325.17,379.17,469.17            MAIN
     2     ,649.17,1729.17,1999.17,2179.17,2431.17,2791.17              MAIN
     3     ,3295.17,3889.17,4357.17,4663.17,4861.17/,PM/                MAIN
     4     3711.0839,2116.2165,472.67563,114.34314,                     MAIN
     5     18.128355,2.3162178,1.2321972,3.8030279E-01,                 MAIN
     6     2.1671352E-02,3.4313478E-03,6.2773411E-04,1.53490            MAIN
     7     91E-04,5.2624212E-05,1.0561806E-05,7.7083076E-06,            MAIN
     8     5.8267151E-06,3.5159854E-06,1.4520255E-06,3.92905            MAIN
     9     63E-07,8.4030242E-08,2.2835256E-08,7.1875452E-09/            MAIN
C     CALCULATE G, Z, AND CHECK                                         MAIN
      Z = A(3)                                                          MAIN
      G = G0*(R0/(R0+Z))**2                                             MAIN
      IF (Z .GT. 295276.0) GO TO 6                                      MAIN
C     TMS LINEAR WITH GEOPOTENTIAL. CALCULATE H AND SEARCH              MAIN
      H      = R0*Z/(R0+Z)                                              MAIN
      DO 3 I = 2,10                                                     MAIN
      J      = I - 1                                                    MAIN
      IF (HG(I) .GE. H) GO TO 4                                         MAIN
    3 CONTINUE                                                          MAIN
C     CALCULATE TMS SLOPE,TMS, AND SET MOL WT STUFF                     MAIN
    4 ELH    = (TM(J+1) - TM(J))/(HG(J+1) - HG(J))                      MAIN
      TMS    = TM(J) +  ELH*(H - HG(J))                                 MAIN
      ELZ    = ELH*G/G0                                                 MAIN
      DMDZ   = 0.0                                                      MAIN
      EM     = WM0                                                      MAIN
                                                                        MAIN
C     CHECK TMS SLOPE AND CALCULATE PRESSURE                            MAIN
      IF (ELH .EQ. 0.0) GO TO 5                                         MAIN
C     NON - ZERO SLOPE PRESSURE EQUATION                                MAIN
      A(4) = PM(J)*(TM(J)/TMS)**(GMRS/ELH)                              MAIN
      GO TO 9                                                           MAIN
C     ZERO SLOPE PRESSURE EQUATION                                      MAIN
    5 A(4) = PM(J)*EXP(GMRS*(HG(J)-H)/TMS)                              MAIN
      GO TO 9                                                           MAIN
C     TMS LINEAR WITH Z. SEARCH MATRIX                                  MAIN
    6 DO 7 I = 2,14                                                     MAIN
      J      = I + 8                                                    MAIN
      K      = I - 1                                                    MAIN
      IF (ZM(I) .GE. Z) GO TO 8                                         MAIN
    7 CONTINUE                                                          MAIN
C     CALCULATE TMS, SLOPE, AND STUFF                                   MAIN
    8 ELZ  = (TM(J+1) - TM(J))/(ZM(K+1) - ZM(K))                        MAIN
      TMS  = TM(J) + ELZ*(Z - ZM(K))                                    MAIN
      DMDZ = (WM(K+1) - WM(K))/(ZM(K+1) - ZM(K))                        MAIN
      EM   = WM(K) + DMDZ*(Z - ZM(K))                                   MAIN
      ZLZ  = Z - TMS/ELZ                                                MAIN
C     PRESSURE EQUATION FOR TMS LINEAR WITH Z                           MAIN
      A(4) = PM(J)*EXP(GMRS/ELZ*(R0/(R0+ZLZ))**2*((Z-ZM(K))*            MAIN
     1       (R0+ZLZ)/(R0+Z)/(R0+ZM(K)) - ALOG(TMS*(R0+ZM(K)            MAIN
     2       )/TM(J)/(R0+Z))))                                          MAIN
C     CALCULATE SOUND SPEED AND DERIVATIVE                              MAIN
    9 A(1) = 49.022164*SQRT(TMS)                                        MAIN
      A(2) = 0.5*ELZ/TMS                                                MAIN
C     CALCULATE DENSITY, DERIVATIVE, AND PRESSURE DERIVATIVE            MAIN
      A(6) = GMRS*A(4)/G0/TMS                                           MAIN
      A(7) = - (A(6)*G/A(4) + ELZ/TMS)                                  MAIN
      A(5) = - A(6)*G                                                   MAIN
C     CALCULATE TEMPERATURE, DERIVATIVE, AND LEAVE                      MAIN
      A(8) = EM*TMS/WM0                                                 MAIN
      A(9) = (EM*ELZ + TMS*DMDZ)/WM0                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOS2(ALT,CS,P,DENS,T, DTDH, DPDH)                    MAIN
C     ANALITICAL REPRESENTATION OF THE 1962 ARDC STANDARD ATMOSPHERE    MAIN
C     TAKEN FROM STOP PROGRAM  (NAS1-5293)                              MAIN
C     ALT      ALTITUDE  (FEET)                                         MAIN
C     CS       SPEED OF SOUND  (FT/SEC)                                 MAIN
C     P        PRESSURE  (POUNDS/SQ. FT)                                MAIN
C     DENS     DENSITY  (SLUGS/CUBIC FT.)                               MAIN
C     T        TEMPERATURE  (DEG RANKINE)                               MAIN
C     GRAD     TEMPERATURE DERIVATIVE  (DTDZ)                           MAIN
C     DPDH     PRESSURE DERIVATIVE                                      MAIN
      DATA R0 /20890855.0/                                              MAIN
      DATA G0 /-32.1740484/                                             MAIN
      Z=6356766.*ALT/(R0 +ALT)                                          MAIN
      IF(Z.LT.11000.)GO TO 30                                           MAIN
      IF(Z.LT.20000.)GO TO 20                                           MAIN
      IF(Z.LT.32000.)GO TO 10                                           MAIN
      IF(Z.LT.48000.)GO TO 5                                            MAIN
      DENS=0.                                                           MAIN
      P=0.                                                              MAIN
      DPDH = 0.0                                                        MAIN
      GRAD = 0.0                                                        MAIN
      DTDH = 0.0                                                        MAIN
      T=489.676                                                         MAIN
      CS=1084.796                                                       MAIN
      RETURN                                                            MAIN
   5  TMB=228.65                                                        MAIN
      GRAD=.0028                                                        MAIN
      ZB=32000.                                                         MAIN
      PB=18.12899                                                       MAIN
      GO TO 40                                                          MAIN
   10 TMB=216.65                                                        MAIN
      GRAD=.001                                                         MAIN
      ZB=20000.                                                         MAIN
      PB=1.14346E2                                                      MAIN
      GO TO 40                                                          MAIN
   20 CS=968.0759                                                       MAIN
      P=  476.283*EXP(-.03416319*(Z-11000.)/216.65)                     MAIN
      DTDH = 0.0                                                        MAIN
      T=389.97                                                          MAIN
      DENS=P/669188.52                                                  MAIN
      GO TO 100                                                         MAIN
   30 IF(Z.LT.0.)Z=0.                                                   MAIN
      TMB=288.15                                                        MAIN
      GRAD=-.0065                                                       MAIN
      ZB=0.                                                             MAIN
      PB=2.11623E3                                                      MAIN
   40 TM=TMB+GRAD*(Z-ZB)                                                MAIN
      CS=SQRT(TM)*65.77034                                              MAIN
      P=PB*(TMB/TM)**(.03416319/GRAD)                                   MAIN
      T=1.8*TM                                                          MAIN
      DTDH = GRAD/1.8                                                   MAIN
      DENS=P/(1716.*T)                                                  MAIN
  100 CONTINUE                                                          MAIN
      G = G0*(R0/(R0 +ALT))**2                                          MAIN
      DPDH = DENS*G                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOS4(HGC7F, HLIM, ANS, PA77P, TA77R, VS77F, RHOAS,   MAIN
     1                  ANUA7F, DTDH)                                   MAIN
C      1963 PATRICK REFERENCE ATMOSPHERE                                MAIN
C                                                                       MAIN
C                          ANSWER   FORMAT                              MAIN
C                                                                       MAIN
C              ANS(1)= PRESSURE RATIO                                   MAIN
C              ANS(2)= KINETIC TEMPERTURE RATIO                         MAIN
C              ANS(3)= DENSITY RATIO                                    MAIN
C              ANS(4)= SPEED OF SOUND RATIO                             MAIN
C              ANS(5)= GRAVITATIONAL ACCELERATION RATIO                 MAIN
C              ANS(6)= MOLECULAR SCALED TEMPERATURE RATIO               MAIN
C              ANS(7)= MEAN MOLECULAR WEIGHT                            MAIN
C              ANS(8)= VISCOSITY RATIO                                  MAIN
C                                                                       MAIN
       REAL LMB,MB,MWT                                                  MAIN
       DIMENSION ANS(8),PB(14),ZI(5),PK(6,5),RHOK(6,3),TK(6,5),VTK(6,3),MAIN
     1 ZB(14),TMB(14),LMB(14),DMB(14),       MB(14)                     MAIN
      EQUIVALENCE (PK, ZPK)                                             MAIN
      EQUIVALENCE (RHOK, ZRHOK)                                         MAIN
      EQUIVALENCE (TK, ZTK)                                             MAIN
      EQUIVALENCE (VTK, ZVTK)                                           MAIN
      REAL ZPK(30), ZRHOK(18), ZTK(30), ZVTK(18)                        MAIN
C                                                                       MAIN
C      DATA STATEMENTS                                                  MAIN
C                                                                       MAIN
       DATA RE,PSL,PBASE/6344860.,10.1701472,6.23101759E-5/             MAIN
       DATA(ZI(I),I=1,5)/10832.1,17853.3,28000.,49000.,83004./          MAIN
      DATA ZPK                                                          MAIN
     1                             /1.6871582E-2,-1.1425176E-4,-1.361232MAIN
     1 7E-9,7.3624145E-14,-1.0800315E-17,3.3046432E-22,-7.9910777E-2,-8.MAIN
     2 1046438E-5,-5.5522383E-9,3.1116969E-13,-1.6687827E-17,3.8319351E-MAIN
     3 22,9.8414277E-1,-2.6976917E-4,8.5227541E-9,-3.9620263E-13,1.01464MAIN
     4 71E-17,-1.0264318E-22,1.1411850E1,-4.1149748E-4,1.3366486E-8,-3.5MAIN
     5 951898E-13,5.1009725E-18,-2.8905589E-23,9.9932446,-2.5829818E-4,3MAIN
     6 .7613935E-9,-4.2088724E-14,1.6018215E-19,-1.9250893E-25/         MAIN
      DATA ZRHOK                                                        MAIN
     1                               /1.3302117E-2,-8.8502064E-5,-4.2143MAIN
     1 056E-9,5.9517557E-13,-3.9744789E-17,7.8771273E-22,1.2667122E-1,  MAIN
     2 -1.3373147E-4,2.0667371E-9,2.3396109E-13,-3.2562503E-17,7.9035209MAIN
     3 E-22,9.2751266E-1,-1.4349679E-4,-2.8271736E-9,4.7480092E-14,     MAIN
     4 1.8863246E-18,-4.2702411E-23/                                    MAIN
      DATA ZTK                                                          MAIN
     1                             /2.9667877E2,-6.7731001E-3,8.4619805EMAIN
     1 -7,-1.7004049E-10,1.1451454E-14,-2.4898788E-19,                  MAIN
     2 2.6892151E2,4.3075352E-3,-8.9159672E-7,-2.8929791E-11,5.0724856E-MAIN
     3 15,-1.1490372E-19,                                               MAIN
     4 3.7064557E2,-3.2858965E-2,2.0645636E-6,-4.3283944E-11,-5.7507242EMAIN
     5 -17,8.2924583E-21,                                               MAIN
     6 2.044798E1,2.0769838 E-2,-8.6303879 E-7,1.6639242 E-11,          MAIN
     7 -9.3007619 E-17,-4.0900511 E-22,                                 MAIN
     8 -4.9886595E2,3.9213728E-2,-4.9518060E-7,-3.2621985E-12,          MAIN
     9 9.6665036E-17,-4.7884428E-22/                                    MAIN
      DATA ZVTK                                                         MAIN
     1                              /2.9937265E2,-7.717628E-3,9.4867202EMAIN
     1 -7,-1.7136592E-10,1.1074297E-14,-2.3294094E-19,                  MAIN
     2 2.6892151E2,4.3075352E-3,-8.9159672E-7,-2.8929791E-11,5.0724856E-MAIN
     3 15,-1.1490372E-19,                                               MAIN
     4 3.7064557E2,-3.2858965E-2,2.0645636E-6,-4.3283944E-11,-5.7507242EMAIN
     5 -17,8.2924583E-21/                                               MAIN
       DATA (ZB(I),I=1,14)/                                             MAIN
     1 9.E4,1.E5,1.1E5,1.2E5,1.5E5,1.6E5,1.7E5,1.9E5,2.3E5,3.E5,4.E5,5.EMAIN
     2 5,6.E5,7.E5/                                                     MAIN
       DATA (TMB(I),I=1,14)/180.65,210.65,260.65,360.65,960.65,1110.65, MAIN
     1 1210.65,1350.65,1550.65,1830.65,2160.65,2420.65,2590.65,2700.65/ MAIN
       DATA (LMB(I),I=1,14)/3.E-3,5.E-3,10.E-3,20.E-3,15.E-3,10.E-3,7.E-MAIN
     1 3,5.E-3,4.E-3,3.3E-3,2.6E-3,1.7E-3,1.1E-3,1.1E-3/                MAIN
       DATA (MB(I),I=1,14)/28.9644,28.88,28.56,28.07,26.92,26.66,26.40, MAIN
     1 25.85,24.70,22.66,19.94,17.94,16.84,16.17/                       MAIN
       DATA (DMB(I),I=1,14)/-0.844E-5,-3.20E-5,-4.9E-5,-3.833E-5,2*-2.60MAIN
     1 E-5,-2.75E-5,-2.875E-5,-2.914E-5,-2.72E-5,-2.0E-5,-1.1E-5,-0.67E-MAIN
     2 5,-0.67E-5/                                                      MAIN
       DATA (PB(I),I=1,14)/.17224436 E-4,.31597171E-5,.77438981E-6,     MAIN
     1 .26597711E-6,.53584938E-7,.39128494E-7,.29591112E-7,             MAIN
     2 .17871566E-7,.73925817E-8,.20057312E-8,.43045661E-9,             MAIN
     3 .11731548E-9,.37019896E-10,.12811533E-10/                        MAIN
C                                                                       MAIN
C                                                                       MAIN
      HMAX=HALT*.3048                                                   MAIN
      H=HGC7F*.3048                                                     MAIN
      IF (HMAX) 1,1,5                                                   MAIN
    5 IF (H-HMAX) 1,10,10                                               MAIN
    1 Z=H                                                               MAIN
       IF(Z-700000.)20,20,10                                            MAIN
   10 ANS(1) = 0.                                                       MAIN
      ANS(2) = 0.                                                       MAIN
      ANS(3) = 0.                                                       MAIN
      ANS(4) = .791785926                                               MAIN
      ANS(5) = 0.                                                       MAIN
      ANS(6) = 0.                                                       MAIN
      ANS(7) = 0.                                                       MAIN
      ANS(8) = 0.                                                       MAIN
      DTDH = 0.0                                                        MAIN
      GO TO 505                                                         MAIN
   20  N=1                                                              MAIN
       IF(Z)30,100,40                                                   MAIN
   30  Z=0.                                                             MAIN
       GO TO 100                                                        MAIN
   40  IF(Z-83004.)50,300,300                                           MAIN
   50  DO 60 N=1,5                                                      MAIN
       IF(Z-ZI(N))100,60,60                                             MAIN
   60  CONTINUE                                                         MAIN
C                                                                       MAIN
C              TEMK AND VISC FOR Z FROM 0 TO 83004M                     MAIN
C                                                                       MAIN
  100  TEMPK=Z*(Z*(Z*(Z*(Z*TK(6,N)+TK(5,N))+TK(4,N))+TK(3,N))+TK(2,N))+ MAIN
     1 TK(1,N)                                                          MAIN
      DTDH =          Z*(Z*(Z*(Z*5.0*TK(6,N) +4.0*TK(5,N)) +3.0*TK(4,N))MAIN
     1                          +2.0*TK(3,N)) +TK(2,N)                  MAIN
       VISCOS=.000001458*((TEMPK*SQRT(TEMPK))/(TEMPK+110.4))            MAIN
       PRES=Z*(Z*(Z*(Z*(Z*PK(6,N)+PK(5,N))+PK(4,N))+PK(3,N))+PK(2,N))+  MAIN
     1 PK(1,N)                                                          MAIN
       PRES=EXP(PRES)                                                   MAIN
  105  IF(Z-28000.)110,200,200                                          MAIN
C                                                                       MAIN
C              PRES AND DEN FOR Z FROM 0 TO 28000M                      MAIN
C                                                                       MAIN
  110  PRES=10.*PRES                                                    MAIN
       DENS=Z*(Z*(Z*(Z*(Z*RHOK(6,N)+RHOK(5,N))+RHOK(4,N))+RHOK(3,N))+   MAIN
     1 RHOK(2,N))+RHOK(1,N)                                             MAIN
       DENS=1.16790729*EXP(DENS)                                        MAIN
  115  IF(Z-12000.)120,120,240                                          MAIN
C                                                                       MAIN
C              SPEED OF SOUND FROM 0 TO 12000M                          MAIN
C                                                                       MAIN
  120  TEMPV=Z*(Z*(Z*(Z*(Z*VTK(6,N)+VTK(5,N))+VTK(4,N))+VTK(3,N))+      MAIN
     1 VTK(2,N))+VTK(1,N)                                               MAIN
       GO TO 330                                                        MAIN
C                                                                       MAIN
C              PRES FOR Z FROM 28000 TO 83004M                          MAIN
C                                                                       MAIN
  200  PRES=.000980665*PRES                                             MAIN
C                                                                       MAIN
C              TEMPV FOR Z FROM 12000 TO 83004M                         MAIN
C                                                                       MAIN
  220  TEMPV=TEMPK                                                      MAIN
       GO TO 320                                                        MAIN
  240  TEMPV=TEMPK                                                      MAIN
       GO TO 330                                                        MAIN
  300  IF(Z-90000.)310,400,400                                          MAIN
C                                                                       MAIN
C              PRES,TEMPK,TEMPV,VISC FOR Z FROM 83004 TO 90000M         MAIN
C                                                                       MAIN
C                                                                       MAIN
  310  PRES=(1373301520000./(Z+RE))*((83004.-Z)/(83004.+RE))/180.65     MAIN
       PRES=PBASE*EXP(PRES)                                             MAIN
       TEMPK=180.65                                                     MAIN
      DTDH = 0.0                                                        MAIN
       TEMPV=TEMPK                                                      MAIN
       VISCOS=.000001458*((TEMPK*SQRT(TEMPK))/(TEMPK+110.4))            MAIN
C                                                                       MAIN
C              DENS,TEMPM,MWT,SOS FOR Z FROM 0 TO 90000M                MAIN
C                                                                       MAIN
  320  DENS=34.83676*(PRES/TEMPK)                                       MAIN
  330  TEMPM=0.                                                         MAIN
       MWT=0.                                                           MAIN
       SPDSO=20.0468*SQRT(TEMPV)                                        MAIN
       GO TO 500                                                        MAIN
C                                                                       MAIN
C              ALL PARAMETERS FOR Z FROM 90000 TO 700000M               MAIN
C                                                                       MAIN
  400  DO 410 N=1,14                                                    MAIN
      NN = N                                                            MAIN
       IF(Z-ZB(N))405,420,410                                           MAIN
  405 CONTINUE                                                          MAIN
      NN = NN-1                                                         MAIN
       GO TO 420                                                        MAIN
  410  CONTINUE                                                         MAIN
  420 CONTINUE                                                          MAIN
      N = NN                                                            MAIN
      TEMPM = Z -ZB(N)                                                  MAIN
       MWT=MB(N)+DMB(N)*TEMPM                                           MAIN
       TEMPM=TMB(N)+LMB(N)*TEMPM                                        MAIN
       TEMPK=(TEMPM/28.9644)*MWT                                        MAIN
      DTDH = 1./28.9644*(DMB(N)*TMB(N) +LMB(N)*MB(N) +2.0*DMB(N)*LMB(N)*MAIN
     1                  (Z -ZB(N)))                                     MAIN
C                                                                       MAIN
       PRES=TMB(N)/(TMB(N)+LMB(N)*(Z-ZB(N)))                            MAIN
       PRES=ALOG(PRES)                                                  MAIN
       DENS=PRES*((1373301520000./(Z+RE))/(LMB(N)*(ZB(N)+RE)))          MAIN
       PRES=EXP(DENS+ALOG(PB(N)))                                       MAIN
       DENS=(PRES/TEMPM)*34.83676                                       MAIN
       SPDSO=SQRT(TEMPM)                                                MAIN
       VISCOS=((TEMPM*SPDSO)/(TEMPM+110.4))*.000001458                  MAIN
       SPDSO=20.0468*SPDSO                                              MAIN
       TEMPV=0.                                                         MAIN
C                                                                       MAIN
C              G FOR ALL Z AND STORE RATIOS                             MAIN
C                                                                       MAIN
  500  ANS(1)=PRES/10.1701472                                           MAIN
       ANS(2)=TEMPK/296.67877                                           MAIN
       ANS(3)=DENS/1.18354674                                           MAIN
       ANS(4)=(SPDSO/1137.9816)*3.2808333                               MAIN
       ANS(5)=(RE/(RE+Z))**2                                            MAIN
       ANS(6)=TEMPM/288.16                                              MAIN
       ANS(7)=MWT                                                       MAIN
       ANS(8)=VISCOS/.00001830243                                       MAIN
      DTDH = DTDH*0.54864                                               MAIN
  505 PA77P=ANS(1)*14.75085*144.                                        MAIN
      TA77R=TEMPK*1.8                                                   MAIN
      VS77F=ANS(4)*1137.9575                                            MAIN
      RHOAS=ANS(3)*2.296947E-03                                         MAIN
      ANUA7F=ANS(8)*0.3822542E-06                                       MAIN
  510 RETURN                                                            MAIN
       END                                                              MAIN
      SUBROUTINE ATMS59(HGC7F, TA77R, PA77P, RHOAS, VS77F, ANUA7F, DTDH)MAIN
      DIMENSION HB(11),RHOB(11),PB(11),TB(11),AK1(11),AK2(11),AK3(11),  MAIN
     1A(2),B(2),C(2),D(2)                                               MAIN
      LOGICAL HGT90,EVEN                                                MAIN
C                                                                       MAIN
C          ALTITUDE ,     DENSITY ,    PRESSURE , TEMPERATURE ,       / MAIN
      DATA   HB( 1) ,    RHOB( 1) ,      PB( 1) ,    TB( 1)   /         MAIN
     1        0.    ,.23769200E-02,2116.2170    ,    518.688  /         MAIN
      DATA   HB( 2) ,    RHOB( 2) ,      PB( 2) ,    TB( 2)   /         MAIN
     2    11000.    ,.70611078E-03, 472.67599   ,    389.988  /         MAIN
      DATA   HB( 3) ,    RHOB( 3) ,      PB( 3) ,    TB( 3)   /         MAIN
     3    25000.    ,.77643892E-04,  51.975418  ,    389.988  /         MAIN
      DATA   HB( 4) ,    RHOB( 4) ,      PB( 4) ,    TB( 4)   /         MAIN
     4    47000.    ,.28803201E-05,   2.5154578 ,    508.788  /         MAIN
      DATA   HB( 5) ,    RHOB( 5) ,      PB( 5) ,    TB( 5)   /         MAIN
     5    53000.    ,.13947125E-05,   1.2180383 ,    508.788  /         MAIN
      DATA   HB( 6) ,    RHOB( 6) ,      PB( 6) ,    TB( 6)   /         MAIN
     6    79000.    ,.41190042E-07,.21082485E-01,    298.188  /         MAIN
      DATA   HB( 7) ,    RHOB( 7) ,      PB( 7) ,    TB( 7)   /         MAIN
     7    90000.    ,.42614856E-08,.21811754E-02,    298.188  /         MAIN
      DATA   HB( 8) ,    RHOB( 8) ,      PB( 8) ,    TB( 8)   /         MAIN
     8   105000.    ,.22324424E-09,.15564912E-03,    406.188  /         MAIN
      DATA   HB( 9) ,    RHOB( 9) ,      PB( 9) ,    TB( 9)   /         MAIN
     9   160000.    ,.18458849E-11,.75604667E-05,   2386.188  /         MAIN
      DATA   HB(10) ,    RHOB(10) ,      PB(10) ,    TB(10)   /         MAIN
     *   170000.    ,.13387990E-11,.58971644E-05,   2566.188  /         MAIN
      DATA   HB(11) ,    RHOB(11) ,      PB(11) ,    TB(11)   /         MAIN
     *   200000.    ,.61150607E-12,.29769746E-05,   2836.188  /         MAIN
C                                                                       MAIN
      DATA   AK1( 1),    AK2( 1)  ,    AK3( 1)  /                       MAIN
     1-.22556913E-04, -5.2561222  ,.00          /                       MAIN
      DATA   AK1( 2),    AK2( 2)  ,    AK3( 2)  /                       MAIN
     2 .0           ,  0.         ,.15768852E-03/                       MAIN
      DATA   AK1( 3),    AK2( 3)  ,    AK3( 3)  /                       MAIN
     3 .13846580E-04, 11.388265   ,.0           /                       MAIN
      DATA   AK1( 4),    AK2( 4)  ,    AK3( 4)  /                       MAIN
     4 .0           ,  0.         ,.12086887E-03/                       MAIN
      DATA   AK1( 5),    AK2( 5)  ,    AK3( 5)  /                       MAIN
     5-.15920187E-04, -7.5921765  ,.0           /                       MAIN
      DATA   AK1( 6),    AK2( 6)  ,    AK3( 6)  /                       MAIN
     6 .0           ,  0.         ,.20623442E-03/                       MAIN
      DATA   AK1( 7),    AK2( 7)  ,    AK3( 7)  /                       MAIN
     7 .24145841E-04,  8.5411986  ,.0           /                       MAIN
      DATA   AK1( 8),    AK2( 8)  ,    AK3( 8)  /                       MAIN
     8 .88628910E-04,  1.7082397  ,.0           /                       MAIN
      DATA   AK1( 9),    AK2( 9)  ,    AK3( 9)  /                       MAIN
     9 .75434123E-05,  3.4164794  ,.0           /                       MAIN
      DATA   AK1(10),    AK2(10)  ,    AK3(10)  /                       MAIN
     * .35071476E-05,  6.8329589  ,.0           /                       MAIN
      DATA   AK1(11),    AK2(11)  ,    AK3(11)  /                       MAIN
     * .22212914E-05,  9.7613698  ,.0           /                       MAIN
C                                                                       MAIN
      DATA   A(1)   ,    B(1)     ,    C(1)     ,    D(1)     /         MAIN
     1 .75951115    , .17416404   ,   220000.   ,    25000.   /         MAIN
      DATA   A(2)   ,    B(2)     ,    C(2)     ,    D(2)     /         MAIN
     2 .93578678    , .27396592   ,   180000.   ,   140000.   /         MAIN
C                                                                       MAIN
      IF(HGC7F .GT. 2.6E6)  GO TO 470                                   MAIN
      HGT90 = .FALSE.                                                   MAIN
      IF(HGC7F .LE. 0.0)  GO TO 460                                     MAIN
       TMP=.3048*HGC7F                                                  MAIN
      HGP=TMP/(1.+TMP/6356766.)                                         MAIN
      HGT90=.TRUE.                                                      MAIN
      M=2                                                               MAIN
      IF (HGP.GT.180000.) GO TO 49                                      MAIN
      M=1                                                               MAIN
      IF (HGP.GT.90000.) GO TO 49                                       MAIN
      HGT90=.FALSE.                                                     MAIN
C  SEARCH FOR   LAYER                                                   MAIN
   49 IF(HGP.LT.HB(11)) GO TO 50                                        MAIN
      LAY = 11                                                          MAIN
      GO TO 60                                                          MAIN
   50 DO 55 I=2,11                                                      MAIN
      IF (HGP.GT.HB(I)) GO TO 55                                        MAIN
      LAY=I-1                                                           MAIN
      GO TO 60                                                          MAIN
 55   CONTINUE                                                          MAIN
 60   TMP=HGP-HB(LAY)                                                   MAIN
      TMP2=1.+AK1(LAY)*TMP                                              MAIN
      TA77R = TB(LAY)*TMP2                                              MAIN
      DTDH = AK1(LAY)*TB(LAY)*0.3048                                    MAIN
C                                                                       MAIN
C  DETERMINE IF THIS IS A CONSTANT TEMPERATURE LAYER                    MAIN
C                                                                       MAIN
      IF(AK1(LAY).EQ.0.) GO TO 72                                       MAIN
C                                                                       MAIN
C  TEMPERATURE NOT CONSTANT                                             MAIN
C                                                                       MAIN
      PA77P=PB(LAY)*TMP2**(-AK2(LAY))                                   MAIN
      RHOAS=RHOB(LAY)*TMP2**(-1.-AK2(LAY))                              MAIN
      GO TO 80                                                          MAIN
 72   TMP3=EXP(-AK3(LAY)*TMP)                                           MAIN
      PA77P=PB(LAY)*TMP3                                                MAIN
      RHOAS=RHOB(LAY)*TMP3                                              MAIN
 80   IF (HGT90) GO TO 85                                               MAIN
      STA77R=SQRT(TA77R)                                                MAIN
      VS77F= 49.021175*STA77R                                           MAIN
      ANUA7F=2.269681E-08*(TA77R*STA77R/((TA77R+198.72)*RHOAS))         MAIN
      RETURN                                                            MAIN
 85   VS77F = 846.50255                                                 MAIN
      ANUA7F = 2.3519251E-07/RHOAS                                      MAIN
      TA77R=TA77R*(A(M)-B(M)*ATAN((HGP-C(M))/D(M)))                     MAIN
      RETURN                                                            MAIN
 460  TA77R = TB(1)                                                     MAIN
      DTDH = -3.56616E-3                                                MAIN
      PA77P=PB(1)                                                       MAIN
      RHOAS=RHOB(1)                                                     MAIN
      GO TO 80                                                          MAIN
 470  VS77F=0.                                                          MAIN
      TA77R=0.                                                          MAIN
      DTDH = 0.0                                                        MAIN
      PA77P=0.                                                          MAIN
      ANUA7F=0.                                                         MAIN
      RHOAS=0.                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMS62(HGC7F, TA77R, PA77P, RHOAS, VS77F, ANUA7F, DTDH)MAIN
      LOGICAL HGT90,EVEN                                                MAIN
      DIMENSION HB(11),RHOB(11),PB(11),TB(11),AK1(11),AK2(11),AK3(11),  MAIN
     1A(2),B(2),C(2),D(2)                                               MAIN
C                                                                       MAIN
C         ALTITUDE,   DENSITY , PRESSURE  ,TEMPERATURE,        /        MAIN
      DATA   HB( 1) ,    RHOB( 1) ,      PB( 1) ,    TB( 1)   /         MAIN
     1       0.   ,.2377002E-2,.2116217E+4,.5186700E+3/                 MAIN
      DATA   HB( 2) ,    RHOB( 2) ,      PB( 2) ,    TB( 2)   /         MAIN
     2.10999474E+5,.7061512E-3,.4726812E+3,.3899700E+3/                 MAIN
      DATA   HB( 3) ,    RHOB( 3) ,      PB( 3) ,    TB( 3)   /         MAIN
     3.19999191E+5,.1708202E-3,.1143431E+3,.3899700E+3/                 MAIN
      DATA   HB( 4) ,    RHOB( 4) ,      PB( 4) ,    TB( 4)   /         MAIN
     4.32354854E+5,.2429209E-4,.1722518E+2,.4131040E+3/                 MAIN
      DATA   HB( 5) ,    RHOB( 5) ,      PB( 5) ,    TB( 5)   /         MAIN
     5.47051401E+5,.2753526E-5,.2302550E+1,.4871700E+3/                 MAIN
      DATA   HB( 6) ,    RHOB( 6) ,      PB( 6) ,    TB( 6)   /         MAIN
     6.52042023E+5,.1466537E-5,.1226346E+1,.4871700E+3/                 MAIN
      DATA   HB( 7) ,    RHOB( 7) ,      PB( 7) ,    TB( 7)   /         MAIN
     7.61077348E+5,.4826665E-6,.3766873E+0,.4546680E+3/                 MAIN
      DATA   HB( 8) ,    RHOB( 8) ,      PB( 8) ,    TB( 8)   /         MAIN
     8.79192936E+5,.3773977E-7,.2106440E-1,.3251700E+3/                 MAIN
C                                                                       MAIN
      DATA   AK1( 1),    AK2( 1)  ,    AK3( 1)  /                       MAIN
     1-.2255877E-4,-.5255871E1,         0./                             MAIN
      DATA   AK1( 2),    AK2( 2)  ,    AK3( 2)  /                       MAIN
     2          0.,         0.,.1576958E-3/                             MAIN
      DATA   AK1( 3),    AK2( 3)  ,    AK3( 3)  /                       MAIN
     3.48012406E-5,.32844801E2,         0./                             MAIN
      DATA   AK1( 4),    AK2( 4)  ,    AK3( 4)  /                       MAIN
     4.12199559E-4,.12202470E2,         0./                             MAIN
      DATA   AK1( 5),    AK2( 5)  ,    AK3( 5)  /                       MAIN
     5          0.,         0.,.1262323E-3/                             MAIN
      DATA   AK1( 6),    AK2( 6)  ,    AK3( 6)  /                       MAIN
     6-.7383899E-5,-.1709562E2,         0./                             MAIN
      DATA   AK1( 7),    AK2( 7)  ,    AK3( 7)  /                       MAIN
     7-.1572230E-4,-.8602817E1,         0./                             MAIN
      DATA   AK1( 8),    AK2( 8)  ,    AK3( 8)  /                       MAIN
     8          0.,         0.,.1891214E-3/                             MAIN
C                                                                       MAIN
      DATA   A(1)   ,    B(1)     ,    C(1)     ,    D(1)     /         MAIN
     1     .759511,   .174164 ,   220.    ,   25.     /                 MAIN
      DATA   A(2)   ,    B(2)     ,    C(2)     ,    D(2)     /         MAIN
     2     .935787,   .273966 ,   180.    ,  140.     /                 MAIN
C                                                                       MAIN
      IF(HGC7F .GT. 2.6E6)  GO TO 470                                   MAIN
      HGT90 = .FALSE.                                                   MAIN
      IF(HGC7F .LE. 0.0)  GO TO 460                                     MAIN
       TMP=.3048*HGC7F                                                  MAIN
      HGP=TMP/(1.+TMP/6356766.)                                         MAIN
      HGT90=.TRUE.                                                      MAIN
      M=2                                                               MAIN
      IF (HGP.GT.180000.) GO TO 49                                      MAIN
      M=1                                                               MAIN
      IF (HGP.GT.90000.) GO TO 49                                       MAIN
      HGT90=.FALSE.                                                     MAIN
C  SEARCH FOR   LAYER                                                   MAIN
   49 IF (HGP.LT.HB(8)) GO TO 50                                        MAIN
      LAY=8                                                             MAIN
      GO TO 60                                                          MAIN
   50 DO 55 I=2,8                                                       MAIN
      IF (HGP.GT.HB(I)) GO TO 55                                        MAIN
      LAY=I-1                                                           MAIN
      GO TO 60                                                          MAIN
 55   CONTINUE                                                          MAIN
 60   TMP=HGP-HB(LAY)                                                   MAIN
      TMP2=1.+AK1(LAY)*TMP                                              MAIN
      TA77R = TB(LAY)*TMP2                                              MAIN
      DTDH = AK1(LAY)*TB(LAY)*0.3048                                    MAIN
C                                                                       MAIN
C  DETERMINE IF THIS IS A CONSTANT TEMPERATURE LAYER                    MAIN
C                                                                       MAIN
      IF(AK1(LAY).EQ.0.) GO TO 72                                       MAIN
C                                                                       MAIN
C  TEMPERATURE NOT CONSTANT                                             MAIN
C                                                                       MAIN
      PA77P=PB(LAY)*TMP2**(-AK2(LAY))                                   MAIN
      RHOAS=RHOB(LAY)*TMP2**(-1.-AK2(LAY))                              MAIN
      GO TO 80                                                          MAIN
 72   TMP3=EXP(-AK3(LAY)*TMP)                                           MAIN
      PA77P=PB(LAY)*TMP3                                                MAIN
      RHOAS=RHOB(LAY)*TMP3                                              MAIN
 80   IF (HGT90) GO TO 85                                               MAIN
      STA77R=SQRT(TA77R)                                                MAIN
      VS77F= 49.020576*STA77R                                           MAIN
      ANUA7F=.0226988E-6*(TA77R*STA77R/((TA77R+198.72)*RHOAS))          MAIN
      RETURN                                                            MAIN
 85   VS77F=883.96                                                      MAIN
      ANUA7F=2.54055E-7/RHOAS                                           MAIN
      TA77R=TA77R*(A(M)-B(M)*ATAN(HGP-C(M)/D(M)))                       MAIN
      RETURN                                                            MAIN
 460  VS77F=1116.43372                                                  MAIN
      TA77R=TB(1)                                                       MAIN
      DTDH = -3.56633E-3                                                MAIN
      PA77P=PB(1)                                                       MAIN
      ANUA7F=1.5723288E-4                                               MAIN
      RHOAS=RHOB(1)                                                     MAIN
      RETURN                                                            MAIN
 470  VS77F = 883.96                                                    MAIN
      TA77R = 325.17                                                    MAIN
      DTDH = 0.0                                                        MAIN
      PA77P=0.                                                          MAIN
      ANUA7F=0.                                                         MAIN
      RHOAS=0.                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ATMOS9(A)                                              MAIN
      COMMON /COMSEG/ XNSEG(500)                                        MAIN
      EQUIVALENCE (XNSEG(364), HG    )                                  MAIN
      EQUIVALENCE (XNSEG(389), TM    )                                  MAIN
      EQUIVALENCE (XNSEG(414), PM    )                                  MAIN
      EQUIVALENCE (XNSEG(439), NHG   )                                  MAIN
C                                                                       MAIN
C     DATA IS ARRANGED IN THE ATMOSPHERE ARRAY, A, AS                   MAIN
C     FOLLOWS                                                           MAIN
C     A(1)  = CS, SPEED OF SOUND, FT/SEC                                MAIN
C     A(2)  = (1/CS)(DCS/DZ), SOUND DERIVATIVE, 1/FT                    MAIN
C     A(3)  = Z, GEOMETRIC ALTITUDE, FT (GIVEN)                         MAIN
C     A(4)  = P, PRESSURE, LB/FT2                                       MAIN
C     A(5)  = DP/DZ, PRESSURE DERIVATIVE, LB/FT3                        MAIN
C     A(6)  = RHO, DENSITY, SLUGS/FT3                                   MAIN
C     A(7)  = (1/RHO)(DRHO/DZ), DENSITY DERIVATIVE, 1/FT                MAIN
C     A(8)  = T, TEMPERATURE, DEG RANKINE                               MAIN
C     A(9)  = DT/DZ, TEMPERATURE DERIVATIVE, DEG RANKINE/FT             MAIN
C                                                                       MAIN
      REAL HG(25), TM(25), PM(25), A(10)                                MAIN
C     SEA LEVEL VALUES FOR VARIOUS CONSTANTS USED                       MAIN
C                                                                       MAIN
C      EARTH RADIUS                = 20890855 FT                        MAIN
                            DATA R0 /20890855.0/                        MAIN
C                                                                       MAIN
C      GRAVITATIONAL ACCELERATION  = 32.1740484 FT/SEC2                 MAIN
                            DATA G0 /32.1740484/                        MAIN
C                                                                       MAIN
C      MOLECULAR WEIGHT            = 28.9644                            MAIN
                           DATA WM0 /28.9644/                           MAIN
C                                                                       MAIN
C      G0*M0/R*                    = 0.018743418 DEG RANK/FT            MAIN
                          DATA GMRS /0.018743418/                       MAIN
C                                                                       MAIN
C                                                                       MAIN
      Z = A(3)                                                          MAIN
      G = G0*(R0/(R0+Z))**2                                             MAIN
C     H      = R0*Z/(R0+Z)                                              MAIN
      H = Z                                                             MAIN
      IF(HG(NHG) .LT. H)  GO TO 777                                     MAIN
C                                                                       MAIN
      DO 3 I = 2,NHG                                                    MAIN
      J      = I - 1                                                    MAIN
      IF (HG(I) .GE. H) GO TO 4                                         MAIN
    3 CONTINUE                                                          MAIN
C                                                                       MAIN
    4 CONTINUE                                                          MAIN
C     CALCULATE TMS SLOPE,TMS, AND SET MOL WT STUFF                     MAIN
      ELH    = (TM(J+1) - TM(J))/(HG(J+1) - HG(J))                      MAIN
      TMS    = TM(J) +  ELH*(H - HG(J))                                 MAIN
      ELZ    = ELH*G/G0                                                 MAIN
      DMDZ   = 0.0                                                      MAIN
      EM     = WM0                                                      MAIN
                                                                        MAIN
C     CHECK TMS SLOPE AND CALCULATE PRESSURE                            MAIN
      IF (ELH .EQ. 0.0) GO TO 5                                         MAIN
C                                                                       MAIN
C     NON - ZERO SLOPE PRESSURE EQUATION                                MAIN
      A(4) = PM(J)*(TM(J)/TMS)**(GMRS/ELH)                              MAIN
      GO TO 9                                                           MAIN
C                                                                       MAIN
    5 CONTINUE                                                          MAIN
C     ZERO SLOPE PRESSURE EQUATION                                      MAIN
      A(4) = PM(J)*EXP(GMRS*(HG(J)-H)/TMS)                              MAIN
C                                                                       MAIN
    9 CONTINUE                                                          MAIN
C     CALCULATE SOUND SPEED AND DERIVATIVE                              MAIN
      A(1) = 49.022164*SQRT(TMS)                                        MAIN
      A(2) = 0.5*ELZ/TMS                                                MAIN
C                                                                       MAIN
C     CALCULATE DENSITY, DERIVATIVE, AND PRESSURE DERIVATIVE            MAIN
      A(6) = GMRS*A(4)/G0/TMS                                           MAIN
      A(7) = - (A(6)*G/A(4) + ELZ/TMS)                                  MAIN
      A(5) = - A(6)*G                                                   MAIN
C                                                                       MAIN
C     CALCULATE TEMPERATURE, DERIVATIVE, AND LEAVE                      MAIN
      A(8) = EM*TMS/WM0                                                 MAIN
      A(9) = (EM*ELZ + TMS*DMDZ)/WM0                                    MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  777 CONTINUE                                                          MAIN
      CALL ATMOS1(A)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE AUGMNT                                                 MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              USER-SUPPLIED SUBROUTINE TO SUPPLY EXTRA THRUST          MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE BCDDEC(BCD, NCHR, DEC)                                 MAIN
      INTEGER BCD(1)                                                    MAIN
      INTEGER POINT                                                     MAIN
      INTEGER E                                                         MAIN
      INTEGER BLANK                                                     MAIN
      DATA BLANK /1H /                                                  MAIN
      DATA POINT /1H./                                                  MAIN
      DATA E /1HE/                                                      MAIN
      DATA NEG /1H-/                                                    MAIN
      IS = 1                                                            MAIN
      INT = 0                                                           MAIN
      F = 0.0                                                           MAIN
      IX = 0                                                            MAIN
      J = 0                                                             MAIN
      DEC = 0.0                                                         MAIN
      DO 5 I=1,NCHR                                                     MAIN
      IF(BCD(I) .NE. BLANK)  GO TO 6                                    MAIN
      J = J +1                                                          MAIN
    5 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
    6 CONTINUE                                                          MAIN
      J = J +1                                                          MAIN
      IF(BCD(J) .NE. NEG)  GO TO 7                                      MAIN
      J = J +1                                                          MAIN
      IS = -1                                                           MAIN
    7 CONTINUE                                                          MAIN
      K = 0                                                             MAIN
      DO 10 I=J,NCHR                                                    MAIN
      IF(BCD(I) .EQ. POINT)  GO TO 100                                  MAIN
      IF(BCD(I) .EQ. E)  GO TO 175                                      MAIN
      K = K +1                                                          MAIN
   10 CONTINUE                                                          MAIN
      CALL BCDINT(BCD, NCHR, DEC)                                       MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
      IF(K .GT. 0)  CALL BCDINT(BCD(J), K, INT)                         MAIN
      DEC = FLOAT(INT)                                                  MAIN
      K = K +J +1                                                       MAIN
      IF(K .GT. NCHR)  GO TO 900                                        MAIN
      L = 0                                                             MAIN
      DO 150 I=K,NCHR                                                   MAIN
      IF(BCD(I) .EQ. BLANK)  GO TO 200                                  MAIN
      IF(BCD(I) .EQ. E)  GO TO 200                                      MAIN
      CALL CHRNUM(BCD(I), N)                                            MAIN
      L = L +1                                                          MAIN
      F = F +FLOAT(N)/10.0**L                                           MAIN
  150 CONTINUE                                                          MAIN
      GO TO 200                                                         MAIN
  175 CONTINUE                                                          MAIN
      IF(K .GT. 0)  CALL BCDINT(BCD(J), K, INT)                         MAIN
      DEC = FLOAT(INT)                                                  MAIN
      K = K +J                                                          MAIN
      L = 0                                                             MAIN
      IF(K .GE. NCHR)  GO TO 900                                        MAIN
  200 CONTINUE                                                          MAIN
      DEC = DEC +F                                                      MAIN
      K = K +L                                                          MAIN
      IF(K .GE. NCHR)  GO TO 900                                        MAIN
      L = NCHR -K                                                       MAIN
      K = K +1                                                          MAIN
      CALL BCDINT(BCD(K), L, IX)                                        MAIN
      IF(IX .EQ. 0)  GO TO 900                                          MAIN
      DEC = DEC*10.0**IX                                                MAIN
  900 CONTINUE                                                          MAIN
      IF(IS .LT. 0)  DEC = -DEC                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE BCDINT(BCD, NCHR, INT)                                 MAIN
      INTEGER BCD(1)                                                    MAIN
      INTEGER BLANK                                                     MAIN
      INTEGER POS                                                       MAIN
      DATA POS /1H+/                                                    MAIN
      DATA NEG /1H-/                                                    MAIN
      DATA BLANK /1H /                                                  MAIN
      INT = 0                                                           MAIN
      DO 5 I=1,NCHR                                                     MAIN
      I1 = I                                                            MAIN
      IF(BCD(I) .NE. BLANK)  GO TO 6                                    MAIN
    5 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
    6 CONTINUE                                                          MAIN
      IS = 1                                                            MAIN
      IF(BCD(I1) .NE. NEG)  GO TO 10                                    MAIN
      IS = -1                                                           MAIN
      I1 = I1 +1                                                        MAIN
   10 CONTINUE                                                          MAIN
      IF(BCD(I1) .EQ. POS)  I1 = I1 +1                                  MAIN
      IF(I1 .GT. NCHR)  RETURN                                          MAIN
      DO 20 I=I1,NCHR                                                   MAIN
      IF(BCD(I) .EQ. BLANK)  GO TO 30                                   MAIN
      CALL CHRNUM(BCD(I), N)                                            MAIN
      INT = INT*10 +N                                                   MAIN
   20 CONTINUE                                                          MAIN
   30 CONTINUE                                                          MAIN
      IF(IS .LT. 0)  INT = -INT                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE BSCALE(Z, NX, NY, NW)                                  MAIN
      REAL Z(1)                                                         MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(14), TR)                                       MAIN
      L = NX +NY                                                        MAIN
      M = L +NW                                                         MAIN
      DO 100 I=1,NW                                                     MAIN
      H = Z(L+I)                                                        MAIN
      CALL ATMOSD                                                       MAIN
      TR15=TR**.5*100.0                                                 MAIN
      DO 50 J=1,NY                                                      MAIN
      DO 10 K=1,NX                                                      MAIN
      Z(M+K) = Z(M+K)*Z(K)/TR15                                         MAIN
   10 CONTINUE                                                          MAIN
      M = M +NX                                                         MAIN
   50 CONTINUE                                                          MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CHANGE(TZ, CNG, NSR)                                   MAIN
      REAL TZ(1)                                                        MAIN
      REAL CNG(1)                                                       MAIN
      NSR = 0                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CHMACH(Z, NX, NY)                                      MAIN
      REAL Z(1)                                                         MAIN
      WRITE(6, 1) (Z(I+NX), I=1,NY)                                     MAIN
    1 FORMAT(1H0, 44X, 11HMACH NUMBER/ 13H ALTITUDE    9(7X, F5.3))     MAIN
      NJ = NY*NX                                                        MAIN
      DO 100 I=1,NX                                                     MAIN
      H = Z(I)                                                          MAIN
      K = I +NX +NY -1                                                  MAIN
      WRITE(6, 2) Z(I), (Z(K+J), J=1,NJ,NX)                             MAIN
    2 FORMAT(1X, F12.0, 9(1X, F11.3))                                   MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CHRNUM(BCD,N)                                          MAIN
      INTEGER BCD, CHR(10)                                              MAIN
      DATA CHR /1H0, 1H1, 1H2, 1H3, 1H4, 1H5, 1H6, 1H7, 1H8, 1H9/       MAIN
      DO 100 I=1,10                                                     MAIN
      N = I -1                                                          MAIN
      IF(CHR(I) .EQ. BCD)  RETURN                                       MAIN
  100 CONTINUE                                                          MAIN
      WRITE(6,200) BCD                                                  MAIN
  200 FORMAT(19H ILLEGAL CHARACTER/A1, 1H/)                             MAIN
      N = 0                                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE COMPAC                                                 MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (CARD  , RDATA(  1))                                  MAIN
      EQUIVALENCE (FLAG  , RDATA( 84))                                  MAIN
      EQUIVALENCE (STAR  , RDATA( 85))                                  MAIN
      EQUIVALENCE (NCOL  , RDATA( 91))                                  MAIN
      EQUIVALENCE (ICOL  , RDATA(131))                                  MAIN
      INTEGER CARD(80)                                                  MAIN
      INTEGER STAR                                                      MAIN
      INTEGER FLAG                                                      MAIN
      INTEGER BLANK                                                     MAIN
      INTEGER POINT                                                     MAIN
      LOGICAL SKIP                                                      MAIN
      LOGICAL BCD, XBCD                                                 MAIN
      DATA STAR /6H*     /                                              MAIN
      DATA FLAG /6H$     /                                              MAIN
      DATA BLANK /6H      /                                             MAIN
      DATA POINT /6H.     /                                             MAIN
      DATA ICOL /1/                                                     MAIN
      IF(CARD(1) .EQ. POINT)  NCOL = 0                                  MAIN
      IF(NCOL .EQ. 0)  RETURN                                           MAIN
      SKIP = .FALSE.                                                    MAIN
      BCD = .FALSE.                                                     MAIN
      L = 0                                                             MAIN
      DO 200 I=ICOL,NCOL                                                MAIN
      IF(FLAG .EQ. BLANK)  GO TO 25                                     MAIN
      IF(SKIP)  GO TO 100                                               MAIN
      IF(CARD(I) .EQ. FLAG)  GO TO 50                                   MAIN
   25 CONTINUE                                                          MAIN
      IF(CARD(I) .EQ. STAR)  GO TO 150                                  MAIN
      IF(BCD)  GO TO 40                                                 MAIN
      IF(CARD(I) .EQ. BLANK)  GO TO 200                                 MAIN
   40 CONTINUE                                                          MAIN
      L = L +1                                                          MAIN
      CARD(L) = CARD(I)                                                 MAIN
      GO TO 200                                                         MAIN
   50 CONTINUE                                                          MAIN
      SKIP = .TRUE.                                                     MAIN
      GO TO 200                                                         MAIN
  100 CONTINUE                                                          MAIN
      IF(CARD(I) .EQ. FLAG)  SKIP = .FALSE.                             MAIN
      GO TO 200                                                         MAIN
  150 CONTINUE                                                          MAIN
      XBCD = .TRUE.                                                     MAIN
      IF(BCD)  XBCD = .FALSE.                                           MAIN
      BCD = XBCD                                                        MAIN
  200 CONTINUE                                                          MAIN
      NCOL = L                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CMAX                                                   MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(111), RCM   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(128), XAA   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(658), EDOT  )                                  MAIN
C          CALCULATES MACH NUMBER FOR MAXIMUM RATE OF CLIMB (MAX EDOT)  MAIN
C                      OR                                               MAIN
C                  MINIMUM FUEL CLIMB GIVEN ALTITUDE AND WEIGHT         MAIN
      INDMHP = 1                                                        MAIN
      IF(XAA .GT. 0.5)  INDMHP = 2                                      MAIN
      CALL HDAMPT(WT, H, AMPT)                                          MAIN
      AM = AMPT                                                         MAIN
      AME = AM                                                          MAIN
      RCM = EDOT*60.0                                                   MAIN
      IF(EDOT .LT. 0.0)  E10 = 4.0                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CONPLT(XTITLE, NCXT, YTITLE, NCYT)                     MAIN
      REAL XEND(4), YEND(4)                                             MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON/FLICOM/SPACE(195)                                          MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      REAL AMHI(23),AMLO(23)                                            MAIN
      ADDON(A,B,C,D) = ABS(C)*(B-A)/ABS(D-C)                            MAIN
      AXLEN=10.0                                                        MAIN
      AYLEN=8.0                                                         MAIN
      XORIGN=0.0                                                        MAIN
      YORIGN=1.0                                                        MAIN
      LINTYP=0                                                          MAIN
      INTEQ = 0                                                         MAIN
C                                                                       MAIN
C     CALL PLOTS(D,1,99)               ...   CALLED FROM MAIN PROGRAM   MAIN
C                  PLOT TAPE IS UNIT 99                                 MAIN
C                                                                       MAIN
      CALL PLOT(0.0, -12.0, -3)                                         MAIN
      CALL PLOT (XORIGN,YORIGN,-3)                                      MAIN
      CALL SCALE(XMESH,AXLEN,NX,1)                                      MAIN
      FIRSTX=XMESH(NX+1)                                                MAIN
      DELTAX=XMESH(NX+2)                                                MAIN
      XEND(3)=FIRSTX                                                    MAIN
      XEND(4)=DELTAX                                                    MAIN
      CALL AXIS(0.0   ,0.0   ,XTITLE,-NCXT, AXLEN,0.,FIRSTX,DELTAX)     MAIN
      CALL SCALE(YMESH,AYLEN,NY,1)                                      MAIN
      FIRSTY=YMESH(NY+1)                                                MAIN
      DELTAY=YMESH(NY+2)                                                MAIN
      CALL AXIS(0.0   ,0.0   ,YTITLE,NCYT, AYLEN,90.,FIRSTY,DELTAY)     MAIN
      YEND(3)=FIRSTY                                                    MAIN
      YEND(4)=DELTAY                                                    MAIN
      NXM1=NX-1                                                         MAIN
      NYM1=NY-1                                                         MAIN
      NZM1=NZ-1                                                         MAIN
      DO 3100 I=1,NXM1                                                  MAIN
      X1=XMESH(I)                                                       MAIN
      X2=XMESH(I+1)                                                     MAIN
      DO 3110 J=1,NYM1                                                  MAIN
      Y1=YMESH(J)                                                       MAIN
      Y2=YMESH(J+1)                                                     MAIN
      AMHIGH=AMHI(J)                                                    MAIN
      AMLOW=AMLO(J)                                                     MAIN
      IF(X2.LT.AMLOW.OR.X1.GT.AMHIGH) GO TO 3110                        MAIN
      DO 3200 K=1,NZ                                                    MAIN
      ZLEVEL = ZCUTS(K)                                                 MAIN
      Z1=ZMESH(I,J)-ZLEVEL                                              MAIN
      Z2=ZMESH(I,J+1)-ZLEVEL                                            MAIN
      Z3=ZMESH(I+1,J+1)-ZLEVEL                                          MAIN
      Z4=ZMESH(I+1,J)-ZLEVEL                                            MAIN
      ID=0                                                              MAIN
      IF(Z1.GT.0.0) ID=ID+8                                             MAIN
      IF(Z2.GT.0.0) ID=ID+4                                             MAIN
      IF(Z3.GT.0.0) ID=ID+2                                             MAIN
      IF(Z4.GT.0.0) ID=ID+1                                             MAIN
      IF(ID.EQ.0) GO TO 2010                                            MAIN
      GO TO (1,10,11,100,101,110,111,1000,1001,1010,1011,1100,          MAIN
     *1101,1110,1111),ID                                                MAIN
 1000 CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(2)=Y1                                                        MAIN
      GO TO 2000                                                        MAIN
 1001 CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 1010 CONTINUE                                                          MAIN
C     CASE 1 UPPER RIGHT TEST                                           MAIN
      I1010=0                                                           MAIN
C     SIGNIFIES WE ARE NOT TESTING A 101 RECTANGLE                      MAIN
 103  CONTINUE                                                          MAIN
      CASE=0.0                                                          MAIN
      IDUM=I+1                                                          MAIN
      JDUM=J+2                                                          MAIN
      ICORNR=0                                                          MAIN
      IF(JDUM.GT.NY) GO TO 1020                                         MAIN
C     CORNER 1.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      IDUM=I+2                                                          MAIN
      IF(IDUM.GT.NX) GO TO 1030                                         MAIN
C     CORNER 2.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      JDUM=J+1                                                          MAIN
C     CORNER 3.                                                         MAIN
 1020 CONTINUE                                                          MAIN
      IF(IDUM.GT.NX) GO TO 1030                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
 1030 CONTINUE                                                          MAIN
C     CASE 1 LOWER LEFT TEST                                            MAIN
      IDUM=I                                                            MAIN
      JDUM=J-1                                                          MAIN
      IF(JDUM.LT.1) GO TO 1040                                          MAIN
C     CORNER 1.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      IDUM=I-1                                                          MAIN
      IF(IDUM.LT.1) GO TO 1050                                          MAIN
C     CORNER 2.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      JDUM=J                                                            MAIN
C     CORNER 3.                                                         MAIN
 1040 CONTINUE                                                          MAIN
      IF(IDUM.LT.1) GO TO 1050                                          MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
 1050 CONTINUE                                                          MAIN
      IF(ICORNR.EQ.0) GO TO 1051                                        MAIN
      CASE1=6.0*CASE/FLOAT(ICORNR)                                      MAIN
      GO TO 1052                                                        MAIN
 1051 CASE1=0.0                                                         MAIN
 1052 CONTINUE                                                          MAIN
C     CASE 2 UPPER LEFT TEST                                            MAIN
      CASE=0.0                                                          MAIN
      ICORNR=0                                                          MAIN
      IDUM=I-1                                                          MAIN
      JDUM=JDUM+1                                                       MAIN
      IF(IDUM.LT.1) GO TO 1060                                          MAIN
C     CORNER 1.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      JDUM=J+2                                                          MAIN
      IF(JDUM.GT.NY) GO TO 1070                                         MAIN
C     CORNER 2.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      IDUM=I                                                            MAIN
 1060 CONTINUE                                                          MAIN
      IF(JDUM.GT.NY) GO TO 1070                                         MAIN
C     CORNER 3.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
 1070 CONTINUE                                                          MAIN
C     CASE 2 LOWER RIGHT TEST                                           MAIN
      IDUM=I+2                                                          MAIN
      JDUM=J                                                            MAIN
      IF(IDUM.GT.NX) GO TO 1080                                         MAIN
C     CORNER 1.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
      JDUM=J-1                                                          MAIN
      IF(JDUM.LT.1) GO TO 1090                                          MAIN
C     CORNER 2.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
 1080 CONTINUE                                                          MAIN
      IDUM=I+1                                                          MAIN
      IF(JDUM.LT.1) GO TO 1090                                          MAIN
C     CORNER 3.                                                         MAIN
      ZTEST=ZMESH(IDUM,JDUM)-ZLEVEL                                     MAIN
      IF(I1010.EQ.1) ZTEST=ZLEVEL-ZMESH(IDUM,JDUM)                      MAIN
      IF(ZTEST.GT.0.0) CASE=CASE+ZTEST                                  MAIN
      ICORNR=ICORNR+1                                                   MAIN
 1090 CONTINUE                                                          MAIN
      IF(ICORNR.EQ.0) GO TO 1091                                        MAIN
      CASE2=6.0*CASE/FLOAT(ICORNR)                                      MAIN
      GO TO 1092                                                        MAIN
 1091 CASE2=0.0                                                         MAIN
 1092 CONTINUE                                                          MAIN
      CASE=CASE1-CASE2                                                  MAIN
      IF(I1010.EQ.1) GO TO 102                                          MAIN
      IF(CASE.LT.0.0) GO TO 2009                                        MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      CALL LINE(XEND,YEND,2,1,LINTYP,INTEQ)                             MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 2009 CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      CALL LINE(XEND,YEND,2,1,LINTYP,INTEQ)                             MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 1100 CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      GO TO 2000                                                        MAIN
 1101 CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(1)=Y2                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 1110 CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 1111 CONTINUE                                                          MAIN
      GO TO 2010                                                        MAIN
 100  CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      GO TO 2000                                                        MAIN
 101  CONTINUE                                                          MAIN
      I1010=1                                                           MAIN
C     SIGNIFIES WE ARE TESTING A 101 RECTANGLE                          MAIN
      GO TO 103                                                         MAIN
 102  CONTINUE                                                          MAIN
      IF(CASE.LT.0.0) GO TO 104                                         MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      CALL LINE(XEND,YEND,2,1,LINTYP,INTEQ)                             MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 104  CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(2)=Y1                                                        MAIN
      CALL LINE(XEND,YEND,2,1,LINTYP,INTEQ)                             MAIN
      XEND(1)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(1)=Y2                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 111  CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(2)=Y1                                                        MAIN
      GO TO 2000                                                        MAIN
 10   CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(1)=Y2                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 11   CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(1)=Y2                                                        MAIN
      XEND(2)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(2)=Y1                                                        MAIN
      GO TO 2000                                                        MAIN
 1    CONTINUE                                                          MAIN
      XEND(1)=X1+ADDON(X1,X2,Z1,Z4)                                     MAIN
      YEND(1)=Y1                                                        MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 1011 CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X1+ADDON(X1,X2,Z2,Z3)                                     MAIN
      YEND(2)=Y2                                                        MAIN
      GO TO 2000                                                        MAIN
 110  CONTINUE                                                          MAIN
      XEND(1)=X1                                                        MAIN
      YEND(1)=Y1+ADDON(Y1,Y2,Z1,Z2)                                     MAIN
      XEND(2)=X2                                                        MAIN
      YEND(2)=Y1+ADDON(Y1,Y2,Z4,Z3)                                     MAIN
      GO TO 2000                                                        MAIN
 2000 CONTINUE                                                          MAIN
      CALL LINE(XEND,YEND,2,1,LINTYP,INTEQ)                             MAIN
 2010 CONTINUE                                                          MAIN
 3200 CONTINUE                                                          MAIN
 3110 CONTINUE                                                          MAIN
 3100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CSCALE(Z, NX, NY)                                      MAIN
      REAL Z(1)                                                         MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(14), TR)                                       MAIN
      DO 100 I=1,NX                                                     MAIN
      H = Z(I)                                                          MAIN
      CALL ATMOSD                                                       MAIN
      TR15=TR**.5                                                       MAIN
      K = I +NX +NY                                                     MAIN
      DO 50 J=1,NY                                                      MAIN
      Z(K) = Z(K)/TR15                                                  MAIN
      K = K +NX                                                         MAIN
   50 CONTINUE                                                          MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DSCALE(Z,NX,NY,NW)                                     MAIN
      REAL Z(1)                                                         MAIN
      COMMON/COMSEG/XNSEG(600)                                          MAIN
      EQUIVALENCE (XNSEG(94), H)                                        MAIN
      EQUIVALENCE (XNSEG(176), ATMOS)                                   MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(14), TR)                                       MAIN
      EQUIVALENCE (ATMOS(2), DR)                                        MAIN
      L=NX+NY                                                           MAIN
      M=L+NW                                                            MAIN
      DO 100 I=1,NW                                                     MAIN
      H=Z(L+I)                                                          MAIN
      CALL ATMOSD                                                       MAIN
      TEMP=TR**1.5*DR                                                   MAIN
      DO 50 J=1,NY                                                      MAIN
      DO 10 K=1,NX                                                      MAIN
      Z(M+K)=Z(M+K)/TEMP                                                MAIN
 10   CONTINUE                                                          MAIN
      M=M+NX                                                            MAIN
 50   CONTINUE                                                          MAIN
 100  CONTINUE                                                          MAIN
C     SCALES FUEL FLOW-CALLED BY ENSET WHEN FF TABLES INPUT 3VAR TABLE  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ESCALE(Z,NX,NY)                                        MAIN
      REAL Z(1)                                                         MAIN
      COMMON/COMSEG/XNSEG(600)                                          MAIN
      EQUIVALENCE (XNSEG(94), H )                                       MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(14), TR )                                      MAIN
      EQUIVALENCE (ATMOS(2), DR )                                       MAIN
      DO 100 I=1,NX                                                     MAIN
      H=Z(I)                                                            MAIN
      CALL ATMOSD                                                       MAIN
      TEMP=TR**1.5*DR                                                   MAIN
      K=I+NX+NY                                                         MAIN
      DO 50 J=1,NY                                                      MAIN
      Z(K)=Z(K)/TEMP                                                    MAIN
      K=K+NX                                                            MAIN
 50   CONTINUE                                                          MAIN
 100  CONTINUE                                                          MAIN
C     SCALES FUEL FLOW-CALLED BY ENSET WHEN FF TABLES INPUT 2VAR TABLE  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DBOUT                                                  MAIN
      COMMON /COMTAB/ TAB(3000)                                         MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      EQUIVALENCE (XNSEG(360), LOCRG )                                  MAIN
      EQUIVALENCE (XNSEG(629), X50   )                                  MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(539), IPSEG )                                  MAIN
      EQUIVALENCE (XNSEG(689), Z11MAP)                                  MAIN
      INTEGER IPSEG(36)                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      REAL RGP(10)                                                      MAIN
      NAME LIST /NSEG0/ LOCTZ, LOCRG, X50, NUMSEG, KPATH,               MAIN
     1                  AMPATH, HPATH, CRANGE, CTIME, CFUEL,            MAIN
     2                  CUMWT, PGAM7D, PVEL, Z11MAP                     MAIN
C                                                                       MAIN
      REWIND 15                                                         MAIN
      READ(15) NUM10                                                    MAIN
      IF(EOF(15))777,1                                                  MAIN
 1    REWIND 25                                                         MAIN
      WRITE(25, NSEG0)                                                  MAIN
      WRITE(25, 100)                                                    MAIN
  100 FORMAT(6H ^TZRG)                                                  MAIN
      LMTZ = NUMSEG*10                                                  MAIN
      CALL TZRGDB(TAB(LOCTZ), TAB(LOCRG), LMTZ)                         MAIN
      READ(15) RGP                                                      MAIN
      IF(EOF(15))  777, 66                                              MAIN
   66 CONTINUE                                                          MAIN
      WRITE(25, 3) RGP                                                  MAIN
    3 FORMAT(5H RGP=5(G12.5, 1H,)/ (5X, 5(G12.5, 1H,)))                 MAIN
   70 CONTINUE                                                          MAIN
      READ(15) RGP                                                      MAIN
      IF(EOF(15))  777, 77                                              MAIN
   77 CONTINUE                                                          MAIN
      WRITE(25, 4) RGP                                                  MAIN
    4 FORMAT(5X, 5(G12.5, 1H,))                                         MAIN
      GO TO 70                                                          MAIN
  777 CONTINUE                                                          MAIN
      WRITE(25, 200)                                                    MAIN
  200 FORMAT(2H ^)                                                      MAIN
      END FILE 25                                                       MAIN
      STOP 77                                                           MAIN
      END                                                               MAIN
      SUBROUTINE DORDER(LIST)                                           MAIN
      LOGICAL LIST                                                      MAIN
      COMMON /DICNAM/ LCOUNT, NAME(504), LOC(504)                       MAIN
      REAL NAME                                                         MAIN
      INTEGER KEY(504)                                                  MAIN
      IF(LIST)  CALL PNAMES                                             MAIN
      CALL SHELL(LOC,KEY,LCOUNT)                                        MAIN
      CALL SHELLX(NAME,KEY,LCOUNT)                                      MAIN
      IF(LIST)  CALL PNAMES                                             MAIN
      CALL SHELL(NAME,KEY,LCOUNT)                                       MAIN
      CALL SHELLX(LOC ,KEY,LCOUNT)                                      MAIN
      IF(LIST)  CALL PNAMES                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DSERCH(SYM,LOC,INDX)                                   MAIN
      COMMON /DICNAM/ LCOUNT, ANAME(504), LOCF(504)                     MAIN
      COMMON /TABNAM/ MAXT, STABLE(126), LOCS(126), IS(126)             MAIN
      INDX = 0                                                          MAIN
      DO 50 I=1,LCOUNT                                                  MAIN
      IF (SYM .NE. ANAME(I) ) GO TO 50                                  MAIN
      INDX = 1                                                          MAIN
      LOC=LOCF(I)                                                       MAIN
      RETURN                                                            MAIN
 50   CONTINUE                                                          MAIN
      DO 100 I=1,MAXT                                                   MAIN
      IF(SYM .NE. STABLE(I)) GO TO 100                                  MAIN
      INDX = 2                                                          MAIN
      LOC=LOCS(I)                                                       MAIN
      IF(IS(I) .NE. 1)  RETURN                                          MAIN
      LOC = 0                                                           MAIN
      INDX = 0                                                          MAIN
                        WRITE(6,51) SYM                                 MAIN
   51 FORMAT(32H *** SPACE WAS NOT ASSIGNED FOR A6)                     MAIN
      RETURN                                                            MAIN
 100  CONTINUE                                                          MAIN
      INDX = 0                                                          MAIN
      LOC = 0                                                           MAIN
      WRITE (6,6) SYM                                                   MAIN
      RETURN                                                            MAIN
  6   FORMAT( 2H0-, A10, 19H-  NOT IN DIRECTORY)                        MAIN
      END                                                               MAIN
      SUBROUTINE DUMPRG(RG)                                             MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      REAL RG(1)                                                        MAIN
      REAL TERM(10)                                                     MAIN
      CALL PAGHED                                                       MAIN
      K = 0                                                             MAIN
      WRITE(6, 99)                                                      MAIN
   99  FORMAT(8H0 DUMPRG//1X, 3HSEG,  6X, 2HWT, 11X, 1HH, 10X, 2HAM, 6X,MAIN
     1       6HTIME  , 8X, 4HFUEL, 6X, 6HRANGE ,  8X, 4HXNZZ, 7X, 3HE10,MAIN
     2       3X, 3HE11, 1X, 6HOPTION)                                   MAIN
      DO 200 M=1,NUMSEG                                                 MAIN
      DO 150 I=1,10                                                     MAIN
      K = K +1                                                          MAIN
      TERM(I) = RG(K)                                                   MAIN
  150 CONTINUE                                                          MAIN
      WRITE(6, 100) M, TERM                                             MAIN
  100 FORMAT(1X, I3, 7G12.4, 2F6.0, I6)                                 MAIN
  200 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DUMPTZ(TZ)                                             MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      REAL TZ(1)                                                        MAIN
      REAL TERM(10)                                                     MAIN
      CALL PAGHED                                                       MAIN
      DO 10 I=1,10                                                      MAIN
      TERM(I) = TZ(I)                                                   MAIN
   10 CONTINUE                                                          MAIN
      WRITE(6, 1) TERM                                                  MAIN
    1 FORMAT(1H0, 52X, 22H MISSION SEGMENT TABLE//9X, 8G12.5, I12, 2X,  MAIN
     1       A10)                                                       MAIN
      K = 10                                                            MAIN
      DO 200 M=2,NUMSEG                                                 MAIN
      DO 150 I=1,10                                                     MAIN
      K = K +1                                                          MAIN
      TERM(I) = TZ(K)                                                   MAIN
  150 CONTINUE                                                          MAIN
      WRITE(6, 100) M, TERM                                             MAIN
  100 FORMAT(1X, I3, 5X, 5G12.5, I12, G12.5, 2I12, 2X, I10)             MAIN
  200 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE EMAX                                                   MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(9),QMSQR)                                      MAIN
      INTEGER PSET, PSTOR                                               MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES MACH NUMBER FOR MAXIMUM ENDURANCE GIVEN       MAIN
C                  WEIGHT AND ALTITUDE                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      PSTOR=PSET                                                        MAIN
      PSET=0                                                            MAIN
      CALL ALTA                                                         MAIN
      XQBD=3.1                                                          MAIN
      Y1=0.0                                                            MAIN
      Y2=0.0                                                            MAIN
      DCL=(CLZZ-WT/(AMIN1(XB0,QMSQR*XB1*XB1)*XQSW))/14.0                MAIN
      CLC=CLZZ+DCL                                                      MAIN
C                                                                       MAIN
      DO 10 I=1,15                                                      MAIN
      Y3=Y2                                                             MAIN
      Y2=Y1                                                             MAIN
      CLC=CLC-DCL                                                       MAIN
      CALL CHECK                                                        MAIN
      Y1=RFAC/VN                                                        MAIN
      IF(Y1 .LT. Y2)  GO TO 9                                           MAIN
 10   CONTINUE                                                          MAIN
C                                                                       MAIN
      PSET = PSTOR                                                      MAIN
      RETURN                                                            MAIN
C     ......                                                            MAIN
    9 CONTINUE                                                          MAIN
      IF(Y3 .GT. 0.0)  GO TO 12                                         MAIN
      CLC=CLC+DCL                                                       MAIN
      GO TO 13                                                          MAIN
 12   X1=CLC                                                            MAIN
 16   X2=CLC+DCL                                                        MAIN
 17   X3=X2+DCL                                                         MAIN
      CALL XFIT2(X1,X2,X3,Y1,Y2,Y3,AA,BB,CC,XATYM,YM,XR,XRR)            MAIN
      CLC=XATYM                                                         MAIN
   13 CONTINUE                                                          MAIN
      CALL CHECK                                                        MAIN
      PSET = PSTOR                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ELT                                                    MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(582), NL    )                                  MAIN
C     RE-SET HEADING INDICATOR FOR SUBROUTINE OUTXXX                    MAIN
      NL = 0                                                            MAIN
      DATA XX/0.0/                                                      MAIN
      CALL SECOND(X)                                                    MAIN
      DIF = X -XX                                                       MAIN
      XX = X                                                            MAIN
C                                                                       MAIN
      WRITE (6,  10)    X, DIF                                          MAIN
   10 FORMAT( 24H0 CUMULATIVE CPU TIME = G12.5, 5X,                     MAIN
     1        34H CPU TIME USED IN PREVIOUS TASK = G12.5)               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ENCASE(AM,CASEN)                                       MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(157), YZA   )                                  MAIN
      EQUIVALENCE (XNSEG(536), FFRMIN)                                  MAIN
      EQUIVALENCE (XNSEG(537), FNMIN )                                  MAIN
      EQUIVALENCE (XNSEG(691), AMSW1 )                                  MAIN
      EQUIVALENCE (XNSEG(692), AMSW2 )                                  MAIN
      INTEGER CASEN, PSET                                               MAIN
      IF(PSET .EQ. 2)  GO TO 100                                        MAIN
      CASEN=1                                                           MAIN
      IF(AM .GT. AMSW1)  CASEN = 3                                      MAIN
      IF(AM .GT. AMSW2)  CASEN = 2                                      MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
C     PSET=2    MIN. POWER                                              MAIN
      YZA = -1.0                                                        MAIN
      FFR = FFRMIN                                                      MAIN
      FN = FNMIN                                                        MAIN
      SFC = FFR/FN                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
        SUBROUTINE ENERGY                                               MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 71), BAREWT)                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(159), ZX5   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(236), ZX10  )                                  MAIN
      EQUIVALENCE (XNSEG(329), TEWT  )                                  MAIN
      EQUIVALENCE (XNSEG(331), TPWT  )                                  MAIN
      EQUIVALENCE (XNSEG(332), PAIRS )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE              (ATMOS(9),QMSQR),(ATMOS(12),SPEED)       MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C                                                                       MAIN
C              THE VARIOUS ENERGY MANEUVERABILITY                       MAIN
C              PARAMETERS AT THE SPECIFIED G LEVEL,                     MAIN
C              MACH, WEIGHT AND ALTITUDE                                MAIN
      WRITE(6, 1462)                                                    MAIN
 1462 FORMAT(101H  MACH  ALTITUDE  WEIGHT   G    CL       PS     PS/WF  MAIN
     1   E-M-E       ES    G(PS=0)     CL      RSTDY)                   MAIN
      CALL ATMOSD                                                       MAIN
      QS=QMSQR*XQSW*AM*AM                                               MAIN
      CL=(WT/QS)*GLEVEL                                                 MAIN
      CALL DRAG                                                         MAIN
      CALL ENDAT                                                        MAIN
      PSEM=((FN-DRT)/WT)*SPEED                                          MAIN
      PSOWF=(PSEM*3600.)/FFR                                            MAIN
      ES=SPEED**2/64.4+H                                                MAIN
      CLL=CL                                                            MAIN
      DCL = 0.5                                                         MAIN
      CL = -0.49999                                                     MAIN
C                                                                       MAIN
      DO 1463 I = 1,20                                                  MAIN
      CL = CL +DCL                                                      MAIN
      CLN = CL                                                          MAIN
      CALL DRAG                                                         MAIN
      PS =((FN - DRT)/WT)*SPEED                                         MAIN
      IF (ABS(PS).LT.0.5) GO TO 1464                                    MAIN
      IF (PS.GT.0.0) GO TO 1463                                         MAIN
      CL = CL-DCL                                                       MAIN
      DCL = DCL/2.0                                                     MAIN
      IF(CL.LT.0.0) GO TO 1470                                          MAIN
1463  CONTINUE                                                          MAIN
C                                                                       MAIN
1470  WRITE(6,1471)                                                     MAIN
1471  FORMAT(62H NO POSITIVE PS VALUE CAN BE FOUND AT THIS MACH ALT. CONMAIN
     1DITION  )                                                         MAIN
 1464 GPSM=CL*QS/WT                                                     MAIN
      PSOWFW = PSOWF*(WT -ZX10 -BAREWT -ZX5*(TPWT +TEWT) -PAIRS*TPWT)   MAIN
      RSTDY=SQRT(1.0/AMAX1(GPSM**2-1.0,0.0))*SPEED**2/32.2              MAIN
      WRITE(6,1465) AM,H,WT,GLEVEL,   CLL,PSEM,PSOWF,PSOWFW,ES,GPSM,CLN,MAIN
     1RSTDY                                                             MAIN
 1465 FORMAT(1H ,F6.3,F8.0,F9.0,F6.1,F6.3,4F10.0,2F8.4,F10.0)           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ENSET                                                  MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      EQUIVALENCE (XNSEG(320), NUMENG)                                  MAIN
      EQUIVALENCE (XNSEG(321), SFCFAC)                                  MAIN
      EQUIVALENCE (XNSEG(322), THRMIN)                                  MAIN
      EQUIVALENCE (XNSEG(323), FFLMIN)                                  MAIN
      EQUIVALENCE (XNSEG(363), IPATMD)                                  MAIN
      EQUIVALENCE (XNSEG(495), LOCTFF)                                  MAIN
      EQUIVALENCE (XNSEG(516), INDT01)                                  MAIN
      EQUIVALENCE (XNSEG(517), INDT02)                                  MAIN
      EQUIVALENCE (XNSEG(518), INDT03)                                  MAIN
      EQUIVALENCE (XNSEG(519), INDT04)                                  MAIN
      EQUIVALENCE (XNSEG(520), INDT05)                                  MAIN
      EQUIVALENCE (XNSEG(521), INDT06)                                  MAIN
      EQUIVALENCE (XNSEG(522), IT01X )                                  MAIN
      EQUIVALENCE (XNSEG(523), IT02X )                                  MAIN
      EQUIVALENCE (XNSEG(524), IT03X )                                  MAIN
      EQUIVALENCE (XNSEG(525), IT04X )                                  MAIN
      EQUIVALENCE (XNSEG(526), IT05X )                                  MAIN
      EQUIVALENCE (XNSEG(527), IT06X )                                  MAIN
      EQUIVALENCE (XNSEG(528), IT01Y )                                  MAIN
      EQUIVALENCE (XNSEG(529), IT02Y )                                  MAIN
      EQUIVALENCE (XNSEG(530), IT03Y )                                  MAIN
      EQUIVALENCE (XNSEG(531), IT04Y )                                  MAIN
      EQUIVALENCE (XNSEG(532), IT05Y )                                  MAIN
      EQUIVALENCE (XNSEG(533), IT06Y )                                  MAIN
      EQUIVALENCE (XNSEG(534), IT02W )                                  MAIN
      EQUIVALENCE (XNSEG(535), IT04W )                                  MAIN
      EQUIVALENCE (XNSEG(536), FFRMIN)                                  MAIN
      EQUIVALENCE (XNSEG(537), FNMIN )                                  MAIN
      EQUIVALENCE (XNSEG(576), IPENDR)                                  MAIN
      EQUIVALENCE (XNSEG(577), IPENDS)                                  MAIN
      INTEGER LOCTFF(21)                                                MAIN
      IPATSV = IPATMD                                                   MAIN
      IPATMD = 0                                                        MAIN
C                                                                       MAIN
      IF(INDT01 .LE. 0)  GO TO 10                                       MAIN
      L = LOCTFF(1)                                                     MAIN
      IF(IPENDR .EQ. 0  .AND.  IPENDS .EQ. 0)   GO TO 2                 MAIN
      CALL PAGHED                                                       MAIN
      IF(IPENDR .EQ. 0)  GO TO 2                                        MAIN
      WRITE(6, 1)                                                       MAIN
    1 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 1, 5X, 8HRAW DATA)         MAIN
      CALL AHMACH(TAB(L), IT01X, IT01Y)                                 MAIN
    2 CONTINUE                                                          MAIN
      CALL ASCALE(TAB(L), IT01X, IT01Y)                                 MAIN
      IF(IPENDS .EQ. 0)  GO TO 10                                       MAIN
      WRITE(6, 3)                                                       MAIN
    3 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 1, 5X, 11HSCALED DATA)     MAIN
      CALL AHMACH(TAB(L), IT01X, IT01Y)                                 MAIN
C                                                                       MAIN
   10 CONTINUE                                                          MAIN
      IF(INDT02 .LE. 0)  GO TO 20                                       MAIN
      L = LOCTFF(2)                                                     MAIN
      IF(IPENDR .EQ. 0)  GO TO 12                                       MAIN
      CALL PAGHED                                                       MAIN
      IF(INDT02.EQ.1)WRITE(6,11)                                        MAIN
      IF(INDT02.EQ.2)WRITE(6,14)                                        MAIN
   11 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 1, 5X,      MAIN
     1       8HRAW DATA)                                                MAIN
      CALL PHMACH(TAB(L), IT02X, IT02Y, IT02W)                          MAIN
   12 CONTINUE                                                          MAIN
      IF(INDT02.EQ.1)CALL BSCALE(TAB(L),IT02X,IT02Y,IT02W)              MAIN
      IF(INDT02.EQ.2)CALL DSCALE(TAB(L),IT02X,IT02Y,IT02W)              MAIN
      IF(IPENDS .EQ. 0)  GO TO 20                                       MAIN
      CALL PAGHED                                                       MAIN
      IF(INDT02.EQ.1)WRITE(6,13)                                        MAIN
      IF(INDT02.EQ.2)WRITE(6,15)                                        MAIN
   13 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 1, 5X,      MAIN
     1       11HSCALED DATA)                                            MAIN
      CALL PHMACH(TAB(L), IT02X, IT02Y, IT02W)                          MAIN
 14   FORMAT(1H0,25X,23HFUEL FLOW LB/HR CASEN=1,5X,8HRAW DATA)          MAIN
 15   FORMAT(1H0,25X,17HFUEL FLOW CASEN=1,5X,11HSCALED DATA)            MAIN
C                                                                       MAIN
   20 CONTINUE                                                          MAIN
      IF(INDT03 .LE. 0)  GO TO 30                                       MAIN
      L = LOCTFF(3)                                                     MAIN
      IF(IPENDR .EQ. 0  .AND.  IPENDS .EQ. 0)   GO TO 22                MAIN
      CALL PAGHED                                                       MAIN
      IF(IPENDR .EQ. 0)  GO TO 22                                       MAIN
      WRITE(6, 21)                                                      MAIN
   21 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 2, 5X, 8HRAW DATA)         MAIN
      CALL AHMACH(TAB(L), IT03X, IT03Y)                                 MAIN
   22 CONTINUE                                                          MAIN
      CALL ASCALE(TAB(L), IT03X, IT03Y)                                 MAIN
      IF(IPENDS .EQ. 0)  GO TO 30                                       MAIN
      WRITE(6, 23)                                                      MAIN
   23 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 2, 5X, 11HSCALED DATA)     MAIN
      CALL AHMACH(TAB(L), IT03X, IT03Y)                                 MAIN
C                                                                       MAIN
   30 CONTINUE                                                          MAIN
      IF(INDT04 .LE. 0)  GO TO 40                                       MAIN
      L = LOCTFF(4)                                                     MAIN
      IF(IPENDR .EQ. 0)  GO TO 32                                       MAIN
      CALL PAGHED                                                       MAIN
      IF(INDT04.EQ.1)WRITE(6,31)                                        MAIN
      IF(INDT04.EQ.2)WRITE(6,34)                                        MAIN
   31 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 2, 5X,      MAIN
     1       8HRAW DATA)                                                MAIN
      CALL PHMACH(TAB(L), IT04X, IT04Y, IT04W)                          MAIN
   32 CONTINUE                                                          MAIN
      IF(INDT04.EQ.1)CALL BSCALE(TAB(L),IT04X,IT04Y,IT04W)              MAIN
      IF(INDT04.EQ.2)CALL DSCALE(TAB(L),IT04X,IT04Y,IT04W)              MAIN
      IF(IPENDS .EQ. 0)  GO TO 40                                       MAIN
      CALL PAGHED                                                       MAIN
      IF(INDT04.EQ.1)WRITE(6,33)                                        MAIN
      IF(INDT04.EQ.2)WRITE(6,35)                                        MAIN
   33 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 2, 5X,      MAIN
     1       11HSCALED DATA)                                            MAIN
      CALL PHMACH(TAB(L), IT04X, IT04Y, IT04W)                          MAIN
 34   FORMAT(1H0,25X,23HFUEL FLOW LB/HR CASEN=2,5X,8HRAW DATA)          MAIN
 35   FORMAT(1H0,25X,17HFUEL FLOW CASEN=2,5X,11HSCALED DATA)            MAIN
C                                                                       MAIN
   40 CONTINUE                                                          MAIN
      IF(INDT05 .LE. 0)  GO TO 50                                       MAIN
      L = LOCTFF(5)                                                     MAIN
      IF(IPENDR .EQ. 0  .AND.  IPENDS .EQ. 0)   GO TO 42                MAIN
      CALL PAGHED                                                       MAIN
      IF(IPENDR .EQ. 0)  GO TO 42                                       MAIN
      WRITE(6, 41)                                                      MAIN
   41 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 3, 5X, 8HRAW DATA)         MAIN
      CALL AHMACH(TAB(L), IT05X, IT05Y)                                 MAIN
   42 CONTINUE                                                          MAIN
      CALL ASCALE(TAB(L), IT05X, IT05Y)                                 MAIN
      IF(IPENDS .EQ. 0)  GO TO 50                                       MAIN
      WRITE(6, 43)                                                      MAIN
   43 FORMAT(1H0, 25X, 20HMAX THRUST CASEN = 3, 5X, 11HSCALED DATA)     MAIN
      CALL AHMACH(TAB(L), IT05X, IT05Y)                                 MAIN
C                                                                       MAIN
   50 CONTINUE                                                          MAIN
      IF(INDT06 .LE. 0)  GO TO 60                                       MAIN
      L = LOCTFF(6)                                                     MAIN
      IF(IPENDR .EQ. 0  .AND.  IPENDS .EQ. 0)   GO TO 52                MAIN
      CALL PAGHED                                                       MAIN
      IF(IPENDR .EQ. 0)  GO TO 52                                       MAIN
      IF(INDT06.EQ.1)WRITE(6,51)                                        MAIN
      IF(INDT06.EQ.2)WRITE(6,54)                                        MAIN
   51 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 3, 5X,      MAIN
     1       8HRAW DATA)                                                MAIN
      CALL CHMACH(TAB(L), IT06X, IT06Y)                                 MAIN
   52 CONTINUE                                                          MAIN
      IF(INDT06.EQ.1)CALL CSCALE(TAB(L),IT06X,IT06Y)                    MAIN
      IF(INDT06.EQ.2)CALL ESCALE(TAB(L),IT06X,IT06Y)                    MAIN
      IF(IPENDS .EQ. 0)  GO TO 60                                       MAIN
      IF(INDT06.EQ.1)WRITE(6,53)                                        MAIN
      IF(INDT06.EQ.2)WRITE(6,55)                                        MAIN
   53 FORMAT(1H0, 25X, 35HSPECIFIC FUEL CONSUMPTION CASEN = 3, 5X,      MAIN
     1       11HSCALED DATA)                                            MAIN
      CALL CHMACH(TAB(L), IT06X, IT06Y)                                 MAIN
 54   FORMAT(1H0,25X,23HFUEL FLOW LB/HR CASEN=3,5X,8HRAW DATA)          MAIN
 55   FORMAT(1H0,25X,17HFUEL FLOW CASEN=3,5X,11HSCALED DATA)            MAIN
   60 CONTINUE                                                          MAIN
      IPATMD = IPATSV                                                   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE ERROR (LOCZ)                                           MAIN
      DATA IBK / 1H  /                                                  MAIN
      CALL LINES (2)                                                    MAIN
      CALL ASRCH (LOCZ,NAME)                                            MAIN
      WRITE (6,1) NAME, LOCZ                                            MAIN
    1 FORMAT(34H0 TABLE ERROR   ...   TABLE NAME=/A6, 12H/  LOCATION=I4)MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FCLMAX                                                 MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(659), LOCCLM)                                  MAIN
      EQUIVALENCE (XNSEG(660), INDCLM)                                  MAIN
      EQUIVALENCE (XNSEG(661), ICLMX )                                  MAIN
      EQUIVALENCE (XNSEG(662), ICLMY )                                  MAIN
      INTEGER CASE                                                      MAIN
      IF(INDCLM .LE. 0)  RETURN                                         MAIN
      ACASE = FLOAT(CASE)                                               MAIN
      CALL HIHO(3, LOCCLM, ICLMX, ICLMY, 0, 0, AM, ACASE, 0, 0, CLMAX)  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FETCH                                                  MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (CARD  , RDATA(  1))                                  MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (OP    , RDATA( 83))                                  MAIN
      EQUIVALENCE (IN    , RDATA( 87))                                  MAIN
      EQUIVALENCE (NOLIST, RDATA( 90))                                  MAIN
      EQUIVALENCE (NCOL  , RDATA( 91))                                  MAIN
      EQUIVALENCE (PAROPT, RDATA( 93))                                  MAIN
      EQUIVALENCE (IX    , RDATA( 95))                                  MAIN
      EQUIVALENCE (ICOL  , RDATA(131))                                  MAIN
      LOGICAL PAROPT                                                    MAIN
      INTEGER CARD(80)                                                  MAIN
      INTEGER IX(36)                                                    MAIN
      LOGICAL NOLIST                                                    MAIN
      INTEGER OP                                                        MAIN
      INTEGER OFF                                                       MAIN
      INTEGER SYMBOL, STOP, END                                         MAIN
      DATA END /3HEND/                                                  MAIN
      DATA INPUT /6HINPUT /                                             MAIN
      DATA STOP /6HSTOP  /                                              MAIN
      DATA LIST /6HLIST  /                                              MAIN
      DATA OFF /6HOFF   /                                               MAIN
      ISYM = SYMBOL                                                     MAIN
  100 CONTINUE                                                          MAIN
      PAROPT=.FALSE.                                                    MAIN
      READ(IN, 101) CARD                                                MAIN
  101 FORMAT(80A1)                                                      MAIN
      IF(EOF(IN))  777,102                                              MAIN
  102 CONTINUE                                                          MAIN
      IF(NOLIST)  GO TO 110                                             MAIN
      IF(ISYM .EQ. END)  CALL PAGHED                                    MAIN
      ISYM = 0                                                          MAIN
      CALL LINES(1)                                                     MAIN
      WRITE(6, 103) CARD                                                MAIN
  103 FORMAT(20X, 80A1)                                                 MAIN
  110 CONTINUE                                                          MAIN
      NCOL = 72                                                         MAIN
      CALL COMPAC                                                       MAIN
      IF(NCOL .EQ. 0)  GO TO 100                                        MAIN
      CALL XTRACT                                                       MAIN
      IF(SYMBOL .EQ. STOP)  CALL EXIT                                   MAIN
C                            CONTINUE PROCESSING DATA CARD              MAIN
      IF(SYMBOL .NE. LIST)  GO TO 115                                   MAIN
      NOLIST = .FALSE.                                                  MAIN
      IF(OP .EQ. OFF)  NOLIST = .TRUE.                                  MAIN
      GO TO 100                                                         MAIN
  115 CONTINUE                                                          MAIN
      IF(SYMBOL .NE. INPUT)  GO TO 120                                  MAIN
      IN = IX(1)                                                        MAIN
      IF(IN .NE. 5)  REWIND IN                                          MAIN
      WRITE(6, 117)  IN                                                 MAIN
  117 FORMAT(36X, 23HINPUT FILE IS NOW UNIT I3)                         MAIN
      ICOL = IX(2)                                                      MAIN
      IF(ICOL .LT. 1)  ICOL = 1                                         MAIN
      IF(ICOL .GT. NCOL)  ICOL = NCOL                                   MAIN
      IF(IN .EQ. 5)  ICOL = 1                                           MAIN
      GO TO 100                                                         MAIN
  120 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
C                                                                       MAIN
  777 CONTINUE                                                          MAIN
      WRITE(6, 92)  IN                                                  MAIN
   92 FORMAT(10(4H ***), 21H END OF FILE ON UNIT I2, 10(4H ***))        MAIN
      IF(IN .EQ. 5)  CALL EXIT                                          MAIN
      IN = 5                                                            MAIN
      ICOL = 1                                                          MAIN
      GO TO 100                                                         MAIN
      END                                                               MAIN
      SUBROUTINE FILBCD(LS, S, BCD)                                     MAIN
      INTEGER BCD(1)                                                    MAIN
      INTEGER B                                                         MAIN
      INTEGER C                                                         MAIN
      INTEGER CM                                                        MAIN
      INTEGER S                                                         MAIN
      DATA B /1H /                                                      MAIN
      DATA CM /1H,/                                                     MAIN
      NB = 0                                                            MAIN
      DO 10 I=1,LS                                                      MAIN
      CALL GET(S, I, C)                                                 MAIN
      IF(B .EQ. C)  GO TO 10                                            MAIN
      IF(C .EQ. CM)  GO TO 12                                           MAIN
      NB = NB +1                                                        MAIN
      BCD(NB) = C                                                       MAIN
   10 CONTINUE                                                          MAIN
   12 CONTINUE                                                          MAIN
      LS = NB                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FILLTZ                                                 MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      COMMON /COMTAB/ C(1)                                              MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      EQUIVALENCE (XNSEG(575), IPTZIN)                                  MAIN
      EQUIVALENCE (NOLIST, RDATA( 90))                                  MAIN
      LOGICAL NOLIST                                                    MAIN
      K = LOCTZ -1 +10*(NUMSEG -1)                                      MAIN
      DO 10 I=1,10                                                      MAIN
      C(I+K) = TERM(I)                                                  MAIN
   10 CONTINUE                                                          MAIN
      IF(IPTZIN .EQ. 0)  RETURN                                         MAIN
      IF(NOLIST)  RETURN                                                MAIN
      CALL LINES(1)                                                     MAIN
      WRITE(6, 100)  TERM                                               MAIN
 100  FORMAT(1X,5G12.5,I12,G12.5,I12,G12.5,2X,I10)                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIENV                                                 MAIN
C     GIVEN WT AND AMA(J),J=1,10, CLZZ=CLMAX                            MAIN
C     CALCULATE FLIGHT ENVELOPE                                         MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(111), RCM   )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(200), DELWT )                                  MAIN
      EQUIVALENCE (XNSEG(201), NWT   )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (DAM, DELAM)                                          MAIN
      EQUIVALENCE (DWT, DELWT)                                          MAIN
      INTEGER CASE, CASEN, PSET                                         MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
C                                                                       MAIN
      XB0=QLIM                                                          MAIN
      XB1=AMLIM                                                         MAIN
      CLZZ=CLMAX                                                        MAIN
      WT = WT +DELWT                                                    MAIN
      AMSAV = AM                                                        MAIN
      DAMSAV = DELAM                                                    MAIN
      DO 1001 JJ=1,NWT                                                  MAIN
      AM = AMSAV                                                        MAIN
      DELAM = DAMSAV                                                    MAIN
      WT=WT-DWT                                                         MAIN
      DO 400 K=1,10                                                     MAIN
      AMA(K)=AM                                                         MAIN
 400  AM=AM+DAM                                                         MAIN
      RMAX=0.0                                                          MAIN
      HMAX=0.0                                                          MAIN
      DO 40 K=1,10                                                      MAIN
      AM=AMA(K)                                                         MAIN
      RC=0.0                                                            MAIN
      CALL BERAN                                                        MAIN
      FE(K,1)=HE                                                        MAIN
      FE(K,3)=H                                                         MAIN
      FE(K,4)=RFAC                                                      MAIN
      IF(RMAX .GT. RFAC)  GO TO 42                                      MAIN
      RMAX=RFAC                                                         MAIN
      AMAX=AMA(K)                                                       MAIN
 42   RC=300.0                                                          MAIN
      CALLTOP                                                           MAIN
      FE(K,2)=H                                                         MAIN
      IF(HMAX .LT. H)  HMAX = H                                         MAIN
   40 CONTINUE                                                          MAIN
      IF(HMAX .LT. 90000.0)  GO TO 50                                   MAIN
      K = 8                                                             MAIN
      DH=10000.0                                                        MAIN
      J=HMAX/DH                                                         MAIN
      HS=FLOAT(J)*DH                                                    MAIN
   50 CONTINUE                                                          MAIN
      IF(HMAX .LT. 45000.0)  GO TO 52                                   MAIN
      DH=10000.0                                                        MAIN
      K=HMAX/DH                                                         MAIN
      HS=FLOAT(K)*10000.0                                               MAIN
      GO TO 56                                                          MAIN
   52 CONTINUE                                                          MAIN
      IF(HMAX .LT. 22500.0)  GO TO 54                                   MAIN
      DH=5000.0                                                         MAIN
      K=HMAX/DH                                                         MAIN
      HS=FLOAT(K)*DH                                                    MAIN
      GO TO 56                                                          MAIN
 54   DH=2500.0                                                         MAIN
      K=HMAX/DH                                                         MAIN
      HS=FLOAT(K)*DH                                                    MAIN
C                                                                       MAIN
 56   HA(1)=HMAX                                                        MAIN
      HA(2)=HS                                                          MAIN
      DO 57 I=1,K                                                       MAIN
      N = I +2                                                          MAIN
      HA(N)=HA(N-1)-DH                                                  MAIN
   57 CONTINUE                                                          MAIN
      DO 58 K=1,N                                                       MAIN
      H=HA(K)                                                           MAIN
      PSET=1                                                            MAIN
      CALL VMAX                                                         MAIN
      FEE(K,1)=VX                                                       MAIN
      FEE(K,2)=AM                                                       MAIN
      CALL CMAX                                                         MAIN
      FEE(K,3)=AME                                                      MAIN
      FEE(K,4)=RCM                                                      MAIN
      PSET=0                                                            MAIN
      CALL EMAX                                                         MAIN
      FEE(K,5)=AM                                                       MAIN
      FEE(K,6)=CLC                                                      MAIN
      FEE(K,7)=RFAC/(VN*WT)*1000.0                                      MAIN
      FEE(K,8)=RFAC/WT*1000.0                                           MAIN
   58 CONTINUE                                                          MAIN
      CALL PAGHED                                                       MAIN
      WRITE (6,59)WT, CASE, CASEN                                       MAIN
 59   FORMAT(1H0,6X,20HFLIGHT ENVELOPE DATA/                            MAIN
     17X,11HAT WEIGHT =F7.0/                                            MAIN
     27X,6HCASE =I2/                                                    MAIN
     37X,7HCASEN =I2//                                                  MAIN
     46H  MACH,2X,8HABSOLUTE,2X,6HCRUISE,3X,11HBEST CRUISE              MAIN
     52X,5HRANGE/8X,7HCEILING,3X,7HCEILING,2X                           MAIN
     68HALTITUDE,5X,6HFACTOR)                                           MAIN
      WRITE(6, 61) (AMA(K), (FE(K, J), J=1,4), K=1,10)                  MAIN
 61   FORMAT(1H ,F6.3,3F9.0,5X,F7.0/)                                   MAIN
      WRITE (6,62)                                                      MAIN
 62   FORMAT(1H0,1X,8HALTITUDE,2X,4HMIN.,2X,4HMAX.,2X,                  MAIN
     122H**MAX. RATE OF CLIMB**,6X,24H**MAX. ENDURANCE FLIGHT           MAIN
     211HCONDITION**/12X,4HMACH,2X,4HMACH,3X,4HMACH,1X,3HNO.,           MAIN
     32X,11HR/C(FT/MIN),4X,4HMACH,1X,3HNO.,2X,2HCL,4X,                  MAIN
     411HHRS/1000LBS,1X,13HN.MI./1000LBS)                               MAIN
      WRITE(6, 64) (HA(K), (FEE(K, J), J=1,8), K=1,N)                   MAIN
 64   FORMAT(1H ,F8.0,F8.3,F6.3,F7.3,5X,F8.0,6X,F6.3,F9.3,              MAIN
     1F9.5,4X,F10.5)                                                    MAIN
      IF(RMAX .GT. 0.0)  GO TO 44                                       MAIN
C     *************                                                     MAIN
      WRITE (6,207)                                                     MAIN
 207  FORMAT(1H0,65HTHIS AIRCRAFT IS UNABLE TO FLY AT ANY OF THE TESTED MAIN
     1MACH NUMBERS.)                                                    MAIN
      RETURN                                                            MAIN
C     ......                                                            MAIN
 44   DAM=AMA(10)-AMA(9)                                                MAIN
 45   AM=AMAX+DAM                                                       MAIN
      IF(ABS(DAM) .LT. 0.001)  GO TO 406                                MAIN
      CALL BERAN                                                        MAIN
      IF(H .GT. 0.0)  GO TO 47                                          MAIN
      DAM=.5*DAM                                                        MAIN
      GO TO 45                                                          MAIN
   47 CONTINUE                                                          MAIN
      IF(RFAC .LE. RMAX)  GO TO 49                                      MAIN
      RMAX=RFAC                                                         MAIN
      AMAX=AM                                                           MAIN
      GO TO 45                                                          MAIN
   49 IF(ABS(DAM) .LT. 0.001)  GO TO 402                                MAIN
      DAM=-.5*DAM                                                       MAIN
      GO TO 45                                                          MAIN
 402  DAM=.01*AMAX                                                      MAIN
 403  AM=AMAX+DAM                                                       MAIN
C          .....                                                        MAIN
      CALL BERAN                                                        MAIN
C          .....                                                        MAIN
      IF(RFAC .GT. 0.995*RMAX)  GO TO 407                               MAIN
      IF(RFAC .GE. 0.985*RMAX)  GO TO 406                               MAIN
      DAM=.5*DAM                                                        MAIN
      GO TO 403                                                         MAIN
 407  DAM=1.5*DAM                                                       MAIN
      GO TO 403                                                         MAIN
 406  AMN=AM                                                            MAIN
      WRITE (6,204)RMAX,AMAX,AMN,CLC,RFAC                               MAIN
 204  FORMAT(1H0,23HA MAX. RANGE FACTOR OF F8.0/                        MAIN
     1,1X,16HOCCURS AT MACH =F7.4/                                      MAIN
     2,29H 99 PERCENT MAX. RANGE FACTOR/                                MAIN
     3,1X,16HOCCURS AT MACH =F7.4,2X,8HAND CL =F6.4/                    MAIN
     4,21H THIS RANGE FACTOR ISF8.0)                                    MAIN
 1001 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIMHC                                                 MAIN
C     CONSTANT ALTITUDE-CONSTANT MACH NO. CRUISE                        MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(206), NH    )                                  MAIN
      EQUIVALENCE (XNSEG(207), WI    )                                  MAIN
      EQUIVALENCE (XNSEG(208), WFF   )                                  MAIN
      EQUIVALENCE (XNSEG(209), NAM   )                                  MAIN
      EQUIVALENCE (XNSEG(210), AMI   )                                  MAIN
      EQUIVALENCE (XNSEG(211), HI    )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS( 5), PR)                                       MAIN
      INTEGER PSET                                                      MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      PSET = 0                                                          MAIN
      N = ALOG10((WI-WFF)/10.)                                          MAIN
C                                                                       MAIN
      DO 801 IKB=1,10                                                   MAIN
      DDWT = FLOAT(IKB)*10.**N                                          MAIN
      IF((WI-WFF)/DDWT.LE. 9.0) GO TO 800                               MAIN
  801 CONTINUE                                                          MAIN
C                                                                       MAIN
  800 K = (WI-WFF)/DDWT                                                 MAIN
      XTT = 20.                                                         MAIN
      IF(NAM .LE. 0)  RETURN                                            MAIN
      H=HI-DELH                                                         MAIN
C                                                                       MAIN
      DO 802 I=1,NH                                                     MAIN
      H=H+DELH                                                          MAIN
      AM = AMI -DELAM                                                   MAIN
      DO 803 J=1,NAM                                                    MAIN
      AM = AM +DELAM                                                    MAIN
      CALL ATMOSD                                                       MAIN
      XQBD = 1.0                                                        MAIN
      QS = XQSW*1481.352*PR*AM**2                                       MAIN
      CALL CHECK                                                        MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,804)H,AM                                                  MAIN
 804  FORMAT(1H0,15X,38HCONSTANT ALTITUDE-CONSTANT MACH CRUISE/         MAIN
     1,20X,10HALTITUDE =F8.0, 5X, 6HMACH =F8.4/                         MAIN
     270H    WEIGHT TIME(HRS) RANGE(NM)  VELOCITY      CL       SFC     MAIN
     3  L/D  )                                                          MAIN
C                                                                       MAIN
      FEE(1,1)=WI                                                       MAIN
      FEE(1,2)=0.0                                                      MAIN
      FEE(1,3)=0.0                                                      MAIN
      FEE(1,4)=VN                                                       MAIN
      FEE(1,5)=CL                                                       MAIN
      FEE(1,6)=SFC                                                      MAIN
      FEE(1,7)=CLCD                                                     MAIN
      W2=WI                                                             MAIN
      WT=WI                                                             MAIN
C                                                                       MAIN
      DO 805 L=1,K                                                      MAIN
      W1=W2                                                             MAIN
      WT=W1                                                             MAIN
      W2=W1-DDWT                                                        MAIN
      XQFP=2.1                                                          MAIN
      LJ=L+1                                                            MAIN
      CALL RUN                                                          MAIN
      FEE(LJ,1)=W2                                                      MAIN
      FEE(LJ,2)=FEE(L,2)+TTR                                            MAIN
      FEE(LJ,3)=FEE(L,3)+RN                                             MAIN
      FEE(LJ,4)=VN                                                      MAIN
      FEE(LJ,5)=CL                                                      MAIN
      FEE(LJ,6)=SFC                                                     MAIN
      FEE(LJ,7)=CLCD                                                    MAIN
  805 CONTINUE                                                          MAIN
C                                                                       MAIN
      WRITE(6,806)((FEE(M,N),N=1,7),M=1,LJ)                             MAIN
 806  FORMAT(1H0,F9.0,F10.2,F10.1,F10.0,F10.3,F10.3,F10.1)              MAIN
C                                                                       MAIN
 803  CONTINUE                                                          MAIN
 802  CONTINUE                                                          MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIMLD                                                 MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(209), NAM   )                                  MAIN
      EQUIVALENCE (XNSEG(212), CDDELT)                                  MAIN
      EQUIVALENCE (XNSEG(613), AMACH )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(9),QMSQR)                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL AMACH(9)                                                     MAIN
      INTEGER CASE                                                      MAIN
C                                                                       MAIN
      AM = AMACH(1)                                                     MAIN
      CALL ATMOSD                                                       MAIN
      KK = 2                                                            MAIN
      DO 11 I=1,NAM                                                     MAIN
      IF(KK .NE. 2)  GO TO 17                                           MAIN
      KK = 0                                                            MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,15) H,CASE                                                MAIN
  15  FORMAT(1H0,10X,11HALTITUDE = ,F10.0,//,11X,7HCASE = ,I4)          MAIN
      WRITE(6,19)                                                       MAIN
   19 FORMAT(1H0,9X,2HCL,10X,2HCD,6X,3HL/D,5X,8HMACH*L/D,3X,4HMACH,5X,4HMAIN
     1DRAG,8X,8HDELTA CD)                                               MAIN
   17 CONTINUE                                                          MAIN
      KK = KK +1                                                        MAIN
      AM = AMACH(I)                                                     MAIN
      QS=QMSQR*AM*AM*XQSW                                               MAIN
      CL=0.0                                                            MAIN
      WRITE(6,16)                                                       MAIN
   16 FORMAT(1H )                                                       MAIN
      DO 12 J=1,17                                                      MAIN
      CALL DRAG                                                         MAIN
      CD=DRT/QS                                                         MAIN
      CLOCD=CL/CD                                                       MAIN
      AMLD=AM*CLOCD                                                     MAIN
      WRITE(6,13)CL,CD,CLOCD,AMLD,AM,DRT,CDDELT                         MAIN
 12   CL=CL+0.05                                                        MAIN
   13 FORMAT(1H ,2F12.5,F8.2,F12.5,F8.3,1F12.3,F12.5)                   MAIN
 11   CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLITOL                                                 MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(597), WL    )                                  MAIN
      EQUIVALENCE (XNSEG(605), W0    )                                  MAIN
      EQUIVALENCE (XNSEG(606), FN0   )                                  MAIN
      INTEGER CASEN                                                     MAIN
      IF(W0 .LE. 0.0)  GO TO 10                                         MAIN
      CASEN = 3                                                         MAIN
      AM = 0.0                                                          MAIN
      H = 0.0                                                           MAIN
      CALL ATMOSD                                                       MAIN
      CALL ENDAT                                                        MAIN
      FN0 = FN                                                          MAIN
      CALL TAKEOF                                                       MAIN
   10 CONTINUE                                                          MAIN
      IF(WL .GT. 0.0)  CALL LANDIN                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIXCP                                                 MAIN
C***  CLIMB PERFORMANCE                                                 MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 93), FWC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(129), XA0   )                                  MAIN
      EQUIVALENCE (XNSEG(130), XA1   )                                  MAIN
      EQUIVALENCE (XNSEG(131), XA2   )                                  MAIN
      EQUIVALENCE (XNSEG(132), XA3   )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(200), DELWT )                                  MAIN
      EQUIVALENCE (XNSEG(204), AMF   )                                  MAIN
      EQUIVALENCE (XNSEG(203), WUTO  )                                  MAIN
      EQUIVALENCE (XNSEG(201), NWT   )                                  MAIN
      EQUIVALENCE (XNSEG(622), IPDGPC)                                  MAIN
      INTEGER PSET                                                      MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      NWT = MIN0(NWT, 10)                                               MAIN
      IF(NWT.LE.0) RETURN                                               MAIN
      DO 301 K=1,NWT                                                    MAIN
      WA(K)=WT                                                          MAIN
      WT = WT -DELWT                                                    MAIN
  301 CONTINUE                                                          MAIN
      PSET=1                                                            MAIN
      DO 70 K=1,NWT                                                     MAIN
      WT=WA(K)-WUTO                                                     MAIN
      AM=AMF                                                            MAIN
      RC=300.0                                                          MAIN
      XB1=AMLIM                                                         MAIN
      XQBD=0.0                                                          MAIN
      IF(AMF .GT. 0.01)  CALL BERAN                                     MAIN
      IF(AMF .LE. 0.01)  CALL RFMAX                                     MAIN
      HF=H                                                              MAIN
      DELH = HF/8.0                                                     MAIN
      LH = 8                                                            MAIN
      H=0.0                                                             MAIN
      AMF=AM                                                            MAIN
      XB0=QLIM                                                          MAIN
      XB1=AMLIM                                                         MAIN
      CLZZ=CLMAX                                                        MAIN
      PSET = 1                                                          MAIN
      CALL CMAX                                                         MAIN
      AM=AME                                                            MAIN
      FW=WUTO                                                           MAIN
      FWC=0.0                                                           MAIN
      XQFP=2.1                                                          MAIN
      XTT=5.0                                                           MAIN
      TIM=0.0                                                           MAIN
      RXC=0.0                                                           MAIN
      TTC=0.0                                                           MAIN
      RAN=0.0                                                           MAIN
      M=1                                                               MAIN
      FE(M,1)=AM                                                        MAIN
      FE(M,2)=H                                                         MAIN
      FE(M,3)=RAN                                                       MAIN
      FE(M,4)=TIM*60.0                                                  MAIN
      FE(M,5)=FW                                                        MAIN
      FE(M,6)=WT                                                        MAIN
C     ............                                                      MAIN
      DO 71 N=1,LH                                                      MAIN
      M=M+1                                                             MAIN
      H0=H                                                              MAIN
      H=H+DELH                                                          MAIN
      PSET = 1                                                          MAIN
      CALL CMAX                                                         MAIN
      AMS=AM                                                            MAIN
      HE=H                                                              MAIN
      H=H0                                                              MAIN
      XQFP = 2.1                                                        MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      XA2=0.0                                                           MAIN
      XA3=0.0                                                           MAIN
      CALL CLIMB                                                        MAIN
      RAN=RAN+RXC                                                       MAIN
      FW=FW+FWC                                                         MAIN
      TIM=TIM+TTC*60.0                                                  MAIN
      FE(M,1)=AM                                                        MAIN
      FE(M,2)=H                                                         MAIN
      FE(M,3)=RAN                                                       MAIN
      FE(M,4)=TIM                                                       MAIN
      FE(M,6)=WT                                                        MAIN
 71   FE(M,5)=FW                                                        MAIN
C     ............                                                      MAIN
      M=M+1                                                             MAIN
      H0=H                                                              MAIN
      AMS=AM                                                            MAIN
      RC=300.0                                                          MAIN
      XB1=AMLIM                                                         MAIN
      AM = AMF                                                          MAIN
      XQBD=0.0                                                          MAIN
      IF(AMF .GT. 0.01)  CALL BERAN                                     MAIN
      IF(AMF .LE. 0.01)  CALL RFMAX                                     MAIN
      HE=H                                                              MAIN
      AME=AM                                                            MAIN
      AM=AMS                                                            MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      H=H0                                                              MAIN
      CALL CLIMB                                                        MAIN
      FE(M,1)=AM                                                        MAIN
      FE(M,2)=H                                                         MAIN
      FE(M,3)=RAN+RXC                                                   MAIN
      FE(M,4)=TIM+TTC*60.0                                              MAIN
      FE(M,5)=FW+FWC                                                    MAIN
      FE(M,6)=WT                                                        MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,72) WA(K), ((FE(J, L), L=1,6), J=1,M)                     MAIN
 72   FORMAT(1H0,10X,33H CLIMB PATH HISTORY FOR WEIGHT = F8.0/          MAIN
     1       1H0,1X,4HMACH,2X,8HALTITUDE,2X,5HRANGE,2X,                 MAIN
     2       4HTIME,3X,4HFUEL,4X,6HWEIGHT/                              MAIN
     3      (1H ,F6.3,F9.0,F8.1,F6.0,F7.0,F10.0/))                      MAIN
C                                                                       MAIN
   70 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIXEP                                                 MAIN
C     ENDURANCE PERFORMANCE                                             MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(206), NH    )                                  MAIN
      EQUIVALENCE (XNSEG(207), WI    )                                  MAIN
      EQUIVALENCE (XNSEG(208), WFF   )                                  MAIN
      EQUIVALENCE (XNSEG(622), IPDGPC)                                  MAIN
      INTEGER PSET                                                      MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      IF(NH .LE. 0)  RETURN                                             MAIN
      XB0 = QLIM                                                        MAIN
      XB1 = AMLIM                                                       MAIN
      XQFP=3.1                                                          MAIN
      N = ALOG10((WI-WFF)/10.)                                          MAIN
      DO 309 IKB=1,10                                                   MAIN
      DDWT = FLOAT(IKB)*10.**N                                          MAIN
      IF((WI-WFF)/DDWT.LE. 9.0) GO TO 308                               MAIN
  309 CONTINUE                                                          MAIN
  308 NWT = (WI-WFF)/DDWT                                               MAIN
      H=H-DELH                                                          MAIN
      PSET=0                                                            MAIN
C     ..............                                                    MAIN
      DO 602 I=1,NH                                                     MAIN
      H=H+DELH                                                          MAIN
      CALL PAGHED                                                       MAIN
      WRITE (6,603)H                                                    MAIN
 603  FORMAT(1H0,22X,21HENDURANCE PERFORMANCE/                          MAIN
     125X,10HALTITUDE =F7.0/                                            MAIN
     22X,63HWEIGHT   FUEL   TIME(HRS)   RANGE(N.M1.)   MACH   CL   SFC  MAIN
     3L/D)                                                              MAIN
      WT=WI                                                             MAIN
      FUEL = 0.0                                                        MAIN
      RANGE=0.0                                                         MAIN
      TIME=0.0                                                          MAIN
      XTT=2.0                                                           MAIN
C                                                                       MAIN
      DO 604 K=1,NWT                                                    MAIN
      W1=WT                                                             MAIN
      W2=W1-DDWT                                                        MAIN
      CLZZ=CLMAX                                                        MAIN
      CALL EMAX                                                         MAIN
      FEE(K,1)=WT                                                       MAIN
      FEE(K,2)=FUEL                                                     MAIN
      FEE(K,3)=TIME                                                     MAIN
      FEE(K,4)=RANGE                                                    MAIN
      FEE(K,5)=AM                                                       MAIN
      FEE(K,6)=CL                                                       MAIN
      FEE(K,7)=SFC                                                      MAIN
      FEE(K,8)=CLCD                                                     MAIN
      CALL RUN                                                          MAIN
      FUEL = FUEL +DDWT                                                 MAIN
      RANGE=RANGE+RN                                                    MAIN
      TIME=TIME+TTR                                                     MAIN
 604  CONTINUE                                                          MAIN
C                                                                       MAIN
      K = NWT +1                                                        MAIN
      FEE(K,1)=WT                                                       MAIN
      FEE(K,2)=FUEL                                                     MAIN
      FEE(K,3)=TIME                                                     MAIN
      FEE(K,4)=RANGE                                                    MAIN
      FEE(K,5)=AM                                                       MAIN
      FEE(K,6)=CL                                                       MAIN
      FEE(K,7)=SFC                                                      MAIN
      FEE(K,8)=CLCD                                                     MAIN
      WRITE (6,605)((FEE(LA,LB),LB=1,8),LA=1,K)                         MAIN
 605  FORMAT(1H0,F7.0,F8.0,F8.3,F13.1,F13.3,F6.3,F6.3,F5.1)             MAIN
 602  CONTINUE                                                          MAIN
C     ........                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FLIXRP                                                 MAIN
C     BEGIN RANGE PERFORMANCE                                           MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      COMMON /FLICOM/  FEE(10,8), FE(10,8), WA(10),AMA(10),HA(10)       MAIN
     1,        RAN, DDWT, JJ, IKB, TIM                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 84), CLCD  )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(207), WI    )                                  MAIN
      EQUIVALENCE (XNSEG(208), WFF   )                                  MAIN
      EQUIVALENCE (XNSEG(209), NAM   )                                  MAIN
      EQUIVALENCE (DAM, DELAM)                                          MAIN
C     --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --MAIN
      IF(NAM.LE.0) RETURN                                               MAIN
      AMSAV = AM                                                        MAIN
      AM=AM-DAM                                                         MAIN
      N = ALOG10((WI-WFF)/10.)                                          MAIN
C                                                                       MAIN
      DO 311 IKB=1,10                                                   MAIN
      DDWT = FLOAT(IKB)*10.**N                                          MAIN
      IF((WI-WFF)/DDWT.LE. 9.0) GO TO 310                               MAIN
  311 CONTINUE                                                          MAIN
C                                                                       MAIN
  310 K = (WI-WFF)/DDWT                                                 MAIN
C     ..............                                                    MAIN
      DO 94 JJ=1,NAM                                                    MAIN
      AM = AMSAV +DELAM*FLOAT(JJ -1)                                    MAIN
      RAN=0.0                                                           MAIN
      TIM=0.0                                                           MAIN
      WT=WI                                                             MAIN
      RC=300.0                                                          MAIN
      CALL BERAN                                                        MAIN
      XTT=5.0                                                           MAIN
      FEE(1,1)=WT                                                       MAIN
      FEE(1,2)=0.0                                                      MAIN
      FEE(1,3)=H                                                        MAIN
      FEE(1,4)=0.0                                                      MAIN
      FEE(1,5)=CL                                                       MAIN
      FEE(1,6)=WT/DRT                                                   MAIN
      FEE(1,7)=SFC                                                      MAIN
      FEE(1,8)=VN                                                       MAIN
      W2=WT                                                             MAIN
C                                                                       MAIN
      M=1                                                               MAIN
C                                                                       MAIN
      DO 90 I=1,K                                                       MAIN
      WT=W2                                                             MAIN
      W1=WT                                                             MAIN
      W2=WT-DDWT                                                        MAIN
      RC=300.0                                                          MAIN
      CALL BERAN                                                        MAIN
      XQFP=1.1                                                          MAIN
      CALL RUN                                                          MAIN
      RAN=RAN+RN                                                        MAIN
      TIM=TIM+TTR                                                       MAIN
      M=M+1                                                             MAIN
      FEE(M,1)=W2                                                       MAIN
      FEE(M,2)=RAN                                                      MAIN
      FEE(M,3)=H                                                        MAIN
      FEE(M,4)=TIM                                                      MAIN
      FEE(M,5)=CL                                                       MAIN
      FEE(M,6)=CLCD                                                     MAIN
      FEE(M,7)=SFC                                                      MAIN
 90   FEE(M,8)=VN                                                       MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE (6,91)AM                                                    MAIN
 91   FORMAT(1H0,19X,24HCRUISE PERFORMANCE CHART/                       MAIN
     120X,6HMACH =F5.3/2X,6HWEIGHT,8H   RANGE,                          MAIN
     211H   ALTITUDE,7H   TIME,6H    CL,7H    L/D,6H   SFC,             MAIN
     311H   VELOCITY)                                                   MAIN
      WRITE (6,93)((FEE(L,K),K=1,8),L=1,M)                              MAIN
 93   FORMAT(1H0,F7.0,F8.0,F10.0,F10.3,F6.3,F6.1,F7.3,F7.0)             MAIN
  94  CONTINUE                                                          MAIN
C     ........                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FNLOSS                                                 MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              USER-SUPPLIED SUBROUTINE TO CORRECT BASIC ENGINE PROPERTIMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FUELIF(IENTRY)                                         MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE IN-FLIGHT FUEL USED,                 MAIN
C     ITS DISPOSITION, TANK DROP TIMES, AND THE FUEL REMAINING          MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(252), JDRPT1)                                  MAIN
      EQUIVALENCE (XNSEG(253), JDRPT2)                                  MAIN
      EQUIVALENCE (XNSEG(254), JDRPT3)                                  MAIN
      EQUIVALENCE (XNSEG(249), MDROP1)                                  MAIN
      EQUIVALENCE (XNSEG(250), MDROP2)                                  MAIN
      EQUIVALENCE (XNSEG(251), MDROP3)                                  MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG(245), TOTSWD)                                  MAIN
      EQUIVALENCE (XNSEG(256), TOTTFD)                                  MAIN
      EQUIVALENCE (XNSEG(255), TOTTWD)                                  MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG(228), WGTUF1)                                  MAIN
      EQUIVALENCE (XNSEG(229), WGTUF2)                                  MAIN
      EQUIVALENCE (XNSEG(230), WGTUF3)                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
C                                                                       MAIN
      GO TO (1000,2000,3000),IENTRY                                     MAIN
 1000 CONTINUE                                                          MAIN
      IUSETK=0                                                          MAIN
      RETURN                                                            MAIN
 2000 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
 3000 CONTINUE                                                          MAIN
      IPASS=0                                                           MAIN
 3001 CONTINUE                                                          MAIN
      IPASS=IPASS+1                                                     MAIN
      IF(IPASS.GT.1000) GO TO 3300                                      MAIN
      IF(IUSETK.GE.4) GO TO 3005                                        MAIN
      IUSETK=4                                                          MAIN
      IF(MDROP3.LT.NTANK3) IUSETK=3                                     MAIN
      IF(MDROP2.LT.NTANK2) IUSETK=2                                     MAIN
      IF(MDROP1.LT.NTANK1) IUSETK=1                                     MAIN
 3005 CONTINUE                                                          MAIN
      GO TO (3010,3020,3030,3040),IUSETK                                MAIN
 3010 CONTINUE                                                          MAIN
      TKFUEL=WGTUF1                                                     MAIN
      GO TO 3040                                                        MAIN
 3020 CONTINUE                                                          MAIN
      TKFUEL=WGTUF2                                                     MAIN
      GO TO 3040                                                        MAIN
 3030 CONTINUE                                                          MAIN
      TKFUEL=WGTUF3                                                     MAIN
 3040 CONTINUE                                                          MAIN
      FUEL = WGTO - WT - PAYWT - TOTTFD - TOTTWD - TOTSWD               MAIN
      DFUEL = FUEL - TOTTFD                                             MAIN
      IF(DFUEL.LT.TKFUEL) GO TO 3200                                    MAIN
      GO TO(3110,3120,3130),IUSETK                                      MAIN
 3110 CONTINUE                                                          MAIN
      JDRPT1=1                                                          MAIN
      GO TO 3140                                                        MAIN
 3120 CONTINUE                                                          MAIN
      JDRPT2=1                                                          MAIN
      GO TO 3140                                                        MAIN
 3130 CONTINUE                                                          MAIN
      JDRPT3=1                                                          MAIN
 3140 CONTINUE                                                          MAIN
      CALL TANKS(3)                                                     MAIN
      GO TO 3001                                                        MAIN
 3200 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
 3300 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      NTAPE6=6                                                          MAIN
 9000 FORMAT(1H0,62H FUEL TANK DROP LOOP IN FUELIF. DROPPED MORE THAN 10MAIN
     *00 TANKS. )                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  GET                                                    MAIN
          ENTRY  GET                                                    MAIN
 +        VFD 18/0HGET,42/3                                             MAIN
 GET      BSSZ 1                                                        MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SB4  B0-1        . INITIALIZE MULTIPLE OF 10 COUNTER.         MAIN
          SA2  B2          . PUT I IN X2.                               MAIN
 LOOP     SB4  B4+1        . COUNT MULTIPLES OF 10.                     MAIN
          SX2  X2-10       . SUBTRACT 10 FROM I.                        MAIN
          ZR   X2,OK       . IF X2 .LE. 0, EXIT FROM LOOP.              MAIN
          PL   X2,LOOP     . LOOP UNTIL NO MORE MULTIPLES OF 10 IN I.   MAIN
 OK       SA1  B1+B4       . LOAD WORD CONTAINING ITH CHAR. OF S.       MAIN
          SA4  MASK1       .                                            MAIN
          SA5  SIX         .                                            MAIN
          SX2  X2+9        . X2 = POSITION IN S WORD.                   MAIN
          PX2  B0,X2       . PACK X2                                    MAIN
          DX2  X2*X5       . MULTIPLY BY SIX                            MAIN
          SB2  X2          .                                            MAIN
          LX1  B2,X1       . LEFT ADJUST ITH CHARACTER.                 MAIN
          SA5  MASK2       .                                            MAIN
          BX6  X1*X4       . MASK OUT REMAINDER OF WORD.                MAIN
          BX6  X5+X6       . FILL X6 WITH BLANKS.                       MAIN
          SA6  B3          . STORE IN T.                                MAIN
          EQ   B0,B0,GET                                                MAIN
 MASK1    DATA 77000000000000000000B                                    MAIN
 MASK2    DATA 00555555555555555555B                                    MAIN
 SIX      DATA 20000000000000000006B                                    MAIN
          END                                                           MAIN
          IDENT  GETIT                                                  MAIN
          ENTRY  GETIT                                                  MAIN
 +        VFD    42/0HGETIT,18/2                                        MAIN
 GETIT    DATA   0           . RETURN EXIT                              MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA1    B1          . ADD TO X1                                MAIN
          SA1    X1          . (ADD) TO X1                              MAIN
          BX6    X1          . (ADD) TO X6                              MAIN
          SA6    B2          . (ADD) TO ANS                             MAIN
          EQ     GETIT       . RETURN                                   MAIN
          END                                                           MAIN
      SUBROUTINE GT I1 I2 (V, AV, NV, I1, I2)                           MAIN
      REAL AV(NV),V                                                     MAIN
      INTEGER GT LT, GT, BLANK                                          MAIN
      DATA GT /4H.GT./                                                  MAIN
      DATA LT /4H.LT./                                                  MAIN
      DATA BLANK /4H    /                                               MAIN
C                                                                       MAIN
      GI = SL VALU ( 1.0, FLOAT(NV), AV(1), V, AV(NV) )                 MAIN
      I2 = MAX 0 ( MIN 0 ( INT(GI +0.5), NV ), 2 )                      MAIN
      I1 = I2 -1                                                        MAIN
      A MAX = A MAX 1 ( AV(1), AV(NV) )                                 MAIN
      A MIN = A MIN 1 ( AV(1), AV(NV) )                                 MAIN
      GT LT = BLANK                                                     MAIN
      IF ( V .LT. A MIN)  GT LT = LT                                    MAIN
      IF ( V .GT. A MAX)  GT LT = GT                                    MAIN
      IF ( GT LT .EQ. BLANK )  GO TO 2                                  MAIN
C                                                                       MAIN
C     VALUE IS NOT IN THE RANGE OF THE TABLE                            MAIN
      WRITE (6, 1)     V, GTLT, AV(I1), AV(I2)                          MAIN
    1 FORMAT (1H , 1PE15.7, 4H IS , A4, 28H THAN ANY VALUE IN THE TABLE,MAIN
     1       28H EXTRAPOLATION WILL BE USED, 1P2E15.7)                  MAIN
      RETURN                                                            MAIN
    2 CONTINUE                                                          MAIN
C   .    .    .    .    .    .    .    .    .    .    .    .    .    .  MAIN
C                                                                       MAIN
      INC = 1                                                           MAIN
      IF ( AV(NV)  .LT.  AV(1) )  INC = -1                              MAIN
      DO 30  I = 1, NV                                                  MAIN
      I3 = I2                                                           MAIN
      A MAX = A MAX 1 ( AV(I1), AV(I2) )                                MAIN
      A MIN = A MIN 1 ( AV(I1), AV(I2) )                                MAIN
      IF ( V  .GT.  A MAX )  GO TO 10                                   MAIN
      IF ( V  .LT.  A MIN )  GO TO 20                                   MAIN
C     CORRECT VALUES OF I1 AND I2 HAVE BEEN DETERMINED                  MAIN
      RETURN                                                            MAIN
   10 CONTINUE                                                          MAIN
      I2 = MAX 0 ( MIN 0 ( I2 +INC, NV ), 2 )                           MAIN
      GO TO 29                                                          MAIN
   20 CONTINUE                                                          MAIN
      I2 = MAX 0 ( MIN 0 ( I2 -INC, NV ), 2 )                           MAIN
   29 CONTINUE                                                          MAIN
      IF ( I2  .EQ.  I3 )  GO TO 40                                     MAIN
      I1 = I2 -1                                                        MAIN
   30 CONTINUE                                                          MAIN
C                                                                       MAIN
C   .    .    .    .    .    .    .    .    .    .    .    .    .    .  MAIN
   40 CONTINUE                                                          MAIN
      WRITE (6, 41)  I1, I2, V, (AV(I),  I = 1, NV)                     MAIN
   41 FORMAT (19H ERROR IN GET I1 I2, 5X, 2I12, 1PE15.7/(1P10E12.4))    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE HEADINX(D1, D2, D3)                                    MAIN
      INTEGER D3(10)                                                    MAIN
      WRITE(6, 100) D3                                                  MAIN
  100 FORMAT(20X, 10(1X, A1))                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE HDCLMB                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      NAME LIST /DBHDOT/ I, K, AMS, H0, AME, HE, WT, DELW,              MAIN
     1                   EDOT1                                          MAIN
      DATA TWOG /64.4/                                                  MAIN
      CALL INIMHP                                                       MAIN
      NUMH = 20                                                         MAIN
      DELH = (HE-H0)/NUMH                                               MAIN
      K = 1                                                             MAIN
      DO 100 I=1,NUMH                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT1 = (FN -DRT)*SPEED/WT                                        MAIN
      DELW = FFR*DELH /(3600.0*EDOT1)                                   MAIN
      HE = H0 +DELH                                                     MAIN
      CALL HDAMPT(WT-DELW, HE, AME)                                     MAIN
      IF(AME .GT. 0.0)  GO TO 2                                         MAIN
      WRITE(6, DBHDOT)                                                  MAIN
      GO TO 100                                                         MAIN
    2 CONTINUE                                                          MAIN
      CALL FLYMHP                                                       MAIN
      H0 = HE                                                           MAIN
      AMS = AME                                                         MAIN
  100 CONTINUE                                                          MAIN
      AME = ENDPT(1)                                                    MAIN
      HE = ENDPT(2)                                                     MAIN
      CALL FLYMHP                                                       MAIN
      CALL MHPTAB(2)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE HIHO (N,LOCZ,NX1,NX2,NX3,NX4,X1ARG,X2ARG,              MAIN
     *X3ARG,X4ARG,A)                                                    MAIN
      COMMON /COMTAB/ TABLE(1)                                          MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      DIMENSION XA(4),NA(4)                                             MAIN
      XA(1)=X1ARG                                                       MAIN
      XA(2)=X2ARG                                                       MAIN
      XA(3)=X3ARG                                                       MAIN
      XA(4)=X4ARG                                                       MAIN
      NA(1)=NX1                                                         MAIN
      NA(2)=NX2                                                         MAIN
      NA(3)=NX3                                                         MAIN
      NA(4)=NX4                                                         MAIN
      NAT=NX1                                                           MAIN
      IF (N-4) 3,4,5                                                    MAIN
    3 NAT=NAT+NA(2)                                                     MAIN
      GO TO 6                                                           MAIN
    4 NAT=NAT+NA(2)+NA(3)                                               MAIN
      GO TO 6                                                           MAIN
 5    NAT=NAT+NA(2)+NA(3)+NA(4)                                         MAIN
6     II=NAT+LOCZ                                                       MAIN
      NEXT=1                                                            MAIN
      CALL NDTLU(N,NA,TABLE(LOCZ),TABLE(II),XA,A,IERROR,NEXT)           MAIN
      IF (IERROR.EQ.0) RETURN                                           MAIN
      CALL ERROR (LOCZ)                                                 MAIN
      CALL LINES (2)                                                    MAIN
      IF (IERROR-1) 7,14,15                                             MAIN
 7    WRITE (6,11)                                                      MAIN
 11   FORMAT (1H0,15X,40HAN ARGUMENT EXCEEDS LOWER LIMIT OF TABLE)      MAIN
      E11=2.0                                                           MAIN
      GO TO 13                                                          MAIN
   14 WRITE (6,12)                                                      MAIN
 12   FORMAT (1H0,15X,40HAN ARGUMENT EXCEEDS UPPER LIMIT OF TABLE)      MAIN
      E11=2.0                                                           MAIN
      GO TO 13                                                          MAIN
   15 WRITE (6,16)                                                      MAIN
 16   FORMAT (1H0,15X,44HINDEPENDENT VARIABLES NOT IN ASCENDING ORDER)  MAIN
      E11=1.0                                                           MAIN
   13 NI=N-1                                                            MAIN
C     IF(E11 .GT. 0.0) RETURN                                           MAIN
      WRITE (6,30) NI,(XA(I),I=1,NI)                                    MAIN
   30 FORMAT(1H0,I2,11H ARGUMENTS ,1P5E15.7)                            MAIN
      NARG=0                                                            MAIN
      NTAB=1                                                            MAIN
      DO 20 I=1,NI                                                      MAIN
      NARG=NARG+NA(I)                                                   MAIN
   20 NTAB=NTAB*NA(I)                                                   MAIN
      WRITE (6,31) (NA(I),I=1,NI)                                       MAIN
   31 FORMAT(21H0ARGUMENT TABLE SIZES,5(I3))                            MAIN
      LA=LOCZ+NARG-1                                                    MAIN
      WRITE (6,32) (TABLE(I),I=LOCZ,LA)                                 MAIN
   32 FORMAT(15H0ARGUMENT TABLE/(1P5E15.7/))                            MAIN
      LV=II+NTAB-1                                                      MAIN
      WRITE (6,33) (TABLE(I),I=II,LV)                                   MAIN
   33 FORMAT(16H0FUNCTION VALUES/(1P5E15.7/))                           MAIN
      CALL EXIT                                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE HNSEG                                                  MAIN
      INTEGER P, C, M1(10), M2(10)                                      MAIN
      DATA P /1H*/                                                      MAIN
      DATA C /1H /                                                      MAIN
      DATA M1 /1H , 1HO, 1HD, 1HI, 1HN, 1H/, 1HM, 1HF, 1HV, 1H /        MAIN
      DATA M2 /1H , 1H , 1H , 1HN, 1HS, 1HE, 1HG, 1H , 1H , 1H /        MAIN
      WRITE(6, 1)                                                       MAIN
    1 FORMAT(1H1/1H0/1H0/1H0)                                           MAIN
      CALL HEADINX(P, C, M1)                                            MAIN
      WRITE(6, 2)                                                       MAIN
    2 FORMAT(1H /1H0/1H0/1H0)                                           MAIN
      CALL HEADINX(P, C, M2)                                            MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INDXCK(INDX, NAME)                                     MAIN
      COMMON /COMSEG/ XNSEG(650)                                        MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      WRITE(6, 225)  NAME                                               MAIN
  225 FORMAT(1H0, A6, 1X, 33HNAME NOT IN LABELED COMMON COMSEG)         MAIN
      NERROR = NERROR+1                                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INITZ                                                  MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      COMMON /COMTAB/ C(1)                                              MAIN
      EQUIVALENCE (XNSEG( 30), AMTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 31), HTO   )                                  MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG( 33), FF    )                                  MAIN
      EQUIVALENCE (XNSEG( 34), FPOL  )                                  MAIN
      EQUIVALENCE (XNSEG(218), RCSC  )                                  MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      DATA BLANK /6H      /                                             MAIN
C     TZ(1) = C(LOCTZ)                                                  MAIN
      K = LOCTZ -1                                                      MAIN
      CALL INIWGT                                                       MAIN
      C(K +1) = AMTO                                                    MAIN
      C(K +2) = HTO                                                     MAIN
      C(K +3) = WGTO                                                    MAIN
      C(K +4) = AMLIM                                                   MAIN
      C(K +5) = QLIM                                                    MAIN
      C(K +6) = FF                                                      MAIN
      C(K +7) = FPOL                                                    MAIN
      C(K +8) = RCSC                                                    MAIN
      C(K +9) = 0.0                                                     MAIN
      C(K+10) = 0.0                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INIWGT                                                 MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
C                                                                       MAIN
      CALL TNKSWT                                                       MAIN
C     TANK DROP AND RETURN WEIGHT STATEMENT                             MAIN
      CALL STORWT                                                       MAIN
C     STORE DROP AND RETURN WEIGHT STATEMENT ONLY                       MAIN
      CALL OVWGTE                                                       MAIN
C     COMPUTES BARE WEIGHT INCLUDINGNON-DROPPED TANKS,                  MAIN
C     STORES, AND THEIR PYLONS, OWE                                     MAIN
      CALL PAYLOD                                                       MAIN
C     COMPUTES PAYLOAD INCLUDING DROPPED TANK, STORE,                   MAIN
C     AND THEIR PYLON CONTRIBUTIONS. TANKS AND THEIR                    MAIN
C     PYLONS ARE ONLY INCLUDED AT THE ANALYSTS SPECIFIC REQUEST         MAIN
      CALL PAGHED                                                       MAIN
      CALL FUELLD                                                       MAIN
C     COMPUTES TOTAL NON-PAYLOAD FUEL ON BOARD, FUELTO                  MAIN
      CALL RETRNW                                                       MAIN
C     COMPUTES TOTAL RETURN WEIGHT, RETWGT                              MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX18                                                  MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX19                                                  MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE IVNAME                                                 MAIN
      COMMON /COMSEG/ XNSEG(650)                                        MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (X     , RDATA( 95))                                  MAIN
      EQUIVALENCE (IX    , RDATA( 95))                                  MAIN
      INTEGER XNSEG                                                     MAIN
      REAL X(36)                                                        MAIN
      INTEGER IX(36)                                                    MAIN
      INTEGER IFIL(4)                                                   MAIN
      DATA IFIL /6HLT   X, 6HLT   Y, 6HLT   W, 6HLT   Z/                MAIN
      DATA NANAM /6HNA    /                                             MAIN
      CALL GET(SYMBOL, 1, C3)                                           MAIN
      CALL GET(SYMBOL, 5, C4)                                           MAIN
      CALL GET(SYMBOL, 6, C5)                                           MAIN
      CALL PUT(NANAM, 3, C3)                                            MAIN
      CALL PUT(NANAM, 4, C4)                                            MAIN
      CALL PUT(NANAM, 5, C5)                                            MAIN
      CALL DSERCH(NANAM, LOC, INDX)                                     MAIN
      IF(INDX .NE. 1)  CALL INDXCK(INDX, NANAM)                         MAIN
      XNSEG(LOC) = NX                                                   MAIN
      DO 300 I=1, NX                                                    MAIN
      IVTAB = IFIL(I)                                                   MAIN
      CALL PUT(IVTAB, 3, C3)                                            MAIN
      CALL PUT(IVTAB, 4, C4)                                            MAIN
      CALL PUT(IVTAB, 5, C5)                                            MAIN
      CALL DSERCH(IVTAB, LOCLT, INDX)                                   MAIN
      IF(INDX .NE. 1)  CALL INDXCK(INDX, IVTAB)                         MAIN
      CALL DSERCH(IX(I), LOC, INDX)                                     MAIN
      IF(INDX .NE. 1)  CALL INDXCK(INDX, IX(I))                         MAIN
      XNSEG(LOCLT) = LOC                                                MAIN
  300 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE LANDIN                                                 MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(583), SREF  )                                  MAIN
      EQUIVALENCE (XNSEG(584), SPLG  )                                  MAIN
      EQUIVALENCE (XNSEG(585), CDPLG )                                  MAIN
      EQUIVALENCE (XNSEG(586), AG    )                                  MAIN
      EQUIVALENCE (XNSEG(587), AMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(588), WINCID)                                  MAIN
      EQUIVALENCE (XNSEG(589), ARTHEO)                                  MAIN
      EQUIVALENCE (XNSEG(590), WSLEFC)                                  MAIN
      EQUIVALENCE (XNSEG(591), CLATOT)                                  MAIN
      EQUIVALENCE (XNSEG(592), CL0   )                                  MAIN
      EQUIVALENCE (XNSEG(593), TRATIO)                                  MAIN
      EQUIVALENCE (XNSEG(594), DFK   )                                  MAIN
      EQUIVALENCE (XNSEG(596), CD0   )                                  MAIN
      EQUIVALENCE (XNSEG(597), WL    )                                  MAIN
      EQUIVALENCE (XNSEG(598), XMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(599), BFOBEX)                                  MAIN
      EQUIVALENCE (XNSEG(601), CFOCAV)                                  MAIN
      EQUIVALENCE (XNSEG(602), SPCHUT)                                  MAIN
      EQUIVALENCE (XNSEG(603), CDPCHT)                                  MAIN
      EQUIVALENCE (XNSEG(604), FNL   )                                  MAIN
      EQUIVALENCE (XNSEG(610), FLAPDL)                                  MAIN
      EQUIVALENCE (XNSEG(611), GRNDFL)                                  MAIN
      IF(WL .LE. 0.0)  RETURN                                           MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,6) SREF, SPLG, CDPLG, AG, AMAXG, WINCID, ARTHEO, WSLEFC   MAIN
    6 FORMAT(1H , 20X, ,29HINPUT TO LANDING CALCULATIONS,               MAIN
     1/57H WING REFERENCE AREA  (SF)                        SREF  =G15.7MAIN
     2/57H FLAT PLATE AREA OF GEAR (SF)                     SPLG  =G15.7MAIN
     3/57H FLAT PLATE DRAG COEFF OF GEAR                    CDPLG =G15.7MAIN
     4/57H GROUND ROLL BODY ANGLE (DEG)                     AG    =G15.7MAIN
     5/57H MAXIMUM GROUND ROTATION ANGLE (DEG)              AMAXG =G15.7MAIN
     6/57H WING INCIDENCE (DEG)                             WINCID=G15.7MAIN
     7/57H THEORETICAL WING ASPECT RATIO                    ARTHEO=G15.7MAIN
     8/57H WING LEADING EDGE SWEEP ANGLE (DEG)              WSLEFC=G15.7MAIN
     *)                                                                 MAIN
      WRITE(6,5)                                                        MAIN
     1CLATOT, CL0, TRATIO, DFK, GRNDFL, CD0, WL, XMAXG, BFOBEX,         MAIN
     2FLAPDL, CFOCAV, SPCHUT, CDPCHT, FNL                               MAIN
    5 FORMAT(                                                           MAIN
     9 57H TOTAL LIFT LIFT CURVE SLOPE (PER DEG)            CLATOT=G15.7MAIN
     */57H LIFT COEF AT ZERO ANGLE OF ATTACK                CL0   =G15.7MAIN
     1/57H WING TAPER RATIO                                 TRATIO=G15.7MAIN
     2/57H INDUCED DRAG FACTOR                              DFK   =G15.7MAIN
     3/57H GROUND ROLL FRICTION COEFFICIENT                 GRNDFL=G15.7MAIN
     4/57H DRAG COEFF AT ZERO LIFT                          CD0   =G15.7MAIN
     5/57H WEIGHT AT START OF LANDING  (LB)                 WL    =G15.7MAIN
     7/57H MAXIMUM GROUND ROLL (FT)  IGNORED, IF ZERO       XMAXG =G15.7MAIN
     8/57H FLAP SPAN TO EXPOSED WING SPAN RATIO             BFOBEX=G15.7MAIN
     9/57H FLAPDEFLECTION (DEG)                             FLAPDL=G15.7MAIN
     */57H AVERAGE FLAP CHORD TO WING CHORD RATIO           CF0CAV=G15.7MAIN
     6/57H FLAT PLATE AREA OF DRAG CHUTE (SF)               SPCHUT=G15.7MAIN
     6/57H FLAT PLATE DRAG COEFF OF CHUTE                   CDPCHT=G15.7MAIN
     6/57H LANDING  THRUST (LB)                             FNL   =G15.7MAIN
     *)                                                                 MAIN
      CALL LANDNG                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE LANDNG                                                 MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(583), SREF  )                                  MAIN
      EQUIVALENCE (XNSEG(584), SPLG  )                                  MAIN
      EQUIVALENCE (XNSEG(585), CDPLG )                                  MAIN
      EQUIVALENCE (XNSEG(586), AG    )                                  MAIN
      EQUIVALENCE (XNSEG(587), AMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(588), WINCID)                                  MAIN
      EQUIVALENCE (XNSEG(589), ARTHEO)                                  MAIN
      EQUIVALENCE (XNSEG(590), WSLEFC)                                  MAIN
      EQUIVALENCE (XNSEG(591), CLATOT)                                  MAIN
      EQUIVALENCE (XNSEG(592), CL0   )                                  MAIN
      EQUIVALENCE (XNSEG(593), TRATIO)                                  MAIN
      EQUIVALENCE (XNSEG(594), DFK   )                                  MAIN
      EQUIVALENCE (XNSEG(596), CD0   )                                  MAIN
      EQUIVALENCE (XNSEG(597), WL    )                                  MAIN
      EQUIVALENCE (XNSEG(598), XMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(599), BFOBEX)                                  MAIN
      EQUIVALENCE (XNSEG(601), CFOCAV)                                  MAIN
      EQUIVALENCE (XNSEG(602), SPCHUT)                                  MAIN
      EQUIVALENCE (XNSEG(603), CDPCHT)                                  MAIN
      EQUIVALENCE (XNSEG(604), FNL   )                                  MAIN
      EQUIVALENCE (XNSEG(610), FLAPDL)                                  MAIN
      EQUIVALENCE (XNSEG(611), GRNDFL)                                  MAIN
      EQUIVALENCE (XNSEG(630), VSTALL)                                  MAIN
      EQUIVALENCE (XNSEG(631), GAM50L)                                  MAIN
      EQUIVALENCE (XNSEG(632), XAIRL )                                  MAIN
      EQUIVALENCE (XNSEG(633), XGL   )                                  MAIN
      EQUIVALENCE (XNSEG(634), VTD   )                                  MAIN
      EQUIVALENCE (XNSEG(635), V50L  )                                  MAIN
      EQUIVALENCE (XNSEG(636), ROS   )                                  MAIN
      FLAPDE = FLAPDL                                                   MAIN
      GRNDFC = GRNDFL                                                   MAIN
      CALL TLAERO(TRATIO, ARTHEO, WSLEFC, CLMAXB, ACLMAX, DCLMAX)       MAIN
      CLMAX = CLMAXB + DCLMAX                                           MAIN
      AWMAX = ACLMAX * 0.80                                             MAIN
      AMAX = AWMAX - WINCID                                             MAIN
      DELCLF = 10.95 * CLATOT * (1.5 * BFOBEX - 0.50 * BFOBEX**2) * SQRTMAIN
     1(CFOCAV) * (0.0625 * FLAPDE - 0.000472 * FLAPDE**2)               MAIN
      CLMAXF = CLMAX + DELCLF                                           MAIN
      WLOS = WL/SREF                                                    MAIN
      VSTAL  = 17.16 * SQRT(WLOS/CLMAXF)                                MAIN
      ATD = AMAXG - 1.0                                                 MAIN
      AWTD = ATD + WINCID                                               MAIN
      CLTD = 57.29 * CLATOT * SIN(AWTD/57.29) * COS(AWTD/57.29)**2 +    MAIN
     1(CLMAX/COS(AWMAX/57.29) - 28.645* CLATOT * SIN(AWMAX/28.645)) *   MAIN
     2SIN(AWTD/57.29)**2 * COS(AWTD/57.29) / SIN(AWMAX/57.29)**2        MAIN
      CLTDF = CLTD + DELCLF                                             MAIN
      IF(CLTDF.LE.0.826*CLMAXF)GO TO 20                                 MAIN
      CLTDF = 0.826*CLMAXF                                              MAIN
      CLTD = CLTDF - DELCLF                                             MAIN
      ATD = CLTD * AWMAX / CLMAX - WINCID                               MAIN
   20 VTD = 17.16 * SQRT(WLOS / CLTDF)                                  MAIN
      V50 = 1.10 * VTD                                                  MAIN
      CL50  = 0.826 * CLTDF                                             MAIN
      CDLG = CDPLG * SPLG / SREF                                        MAIN
      CD50  = CD0 + DFK * CL50  * (CL50  - CL0 - DELCLF) + CDLG         MAIN
      CDTD = CD0 + DFK * CLTDF * (CLTDF - CL0 - DELCLF) + CDLG          MAIN
      CDAV = (CD50  + CDTD)  * 0.50                                     MAIN
      XAIR = (50.0 + 2.745 * WLOS / CLTDF) / (1.105 * CDAV / CLTDF -    MAIN
     1FNL / WL)                                                         MAIN
      ROS = 1.69 * V50 * (CD50 / CL50 - FNL / WL)                       MAIN
      GAM50 =   ASIN(CD50 / CL50 - FNL / WL)                            MAIN
      GAM50 = GAM50 * 57.29                                             MAIN
      AWG = AG + WINCID                                                 MAIN
      CLG = 57.29 * CLATOT * SIN(AWG/57.29) * COS(AWG/57.29)**2 +       MAIN
     1(CLMAX / COS(AWMAX/57.29) - 28.645 * CLATOT * SIN(AWMAX/28.645)) *MAIN
     2SIN(AWG /57.29)**2 * COS(AWG / 57.29) / SIN(AWMAX / 57.29)**2     MAIN
      CDCHUT = CDPCHT * SPCHUT / SREF                                   MAIN
      CDG = CD0 + DFK * CLG * (CLG - CL0) + CDLG + CDCHUT               MAIN
      XG = (13.07 * WLOS / CLTDF) / (GRNDFC + 0.5 * (CDG - GRNDFC * CLG)MAIN
     1/ CLTDF)                                                          MAIN
C                                                                       MAIN
      WRITE(6,66)                                                       MAIN
   66 FORMAT(1H0, 20X, 32HOUTPUT FROM LANDING CALCULATIONS)             MAIN
C                                                                       MAIN
      IF(XMAXG.EQ.0.0) GO TO 21                                         MAIN
      IF(XG.LE.XMAXG) GO TO 21                                          MAIN
      STHREQ = (13.07 * WL / (XMAXG * CLTDF)) / (GRNDFC + 0.5 * (CDG -  MAIN
     1GRNDFC * CLG) / CLTDF)                                            MAIN
C                                                                       MAIN
      WRITE(6, 5) STHREQ, XMAXG                                         MAIN
    5 FORMAT(40X, 40HTHE GROUND RUN EXCEEDS X GROUND MAX ... //16X,     MAIN
     1       27HA THEORETICAL WING AREA OF F6.0,                        MAIN
     2       46H SQ. FT. IS REQUIRED TO LAND IN A DISTANCE OF F6.0,     MAIN
     3       5H FEET//)                                                 MAIN
C                                                                       MAIN
   21 CONTINUE                                                          MAIN
      WRITE(6,6) CLMAX, CLMAXF, DELCLF, CLTD, CLTDF, ATD, VTD, V50      MAIN
    6 FORMAT(1H                                                         MAIN
     2/57H MAXIMUM WING LIFT COEFFICIENT                    CLMAX =G15.7MAIN
     3/57H MAXIMUM WING PLUS FLAP LIFT COEFFICIENT          CLMAXF=G15.7MAIN
     4/57H FLAP LIFT COEFFICIENT INCREMENT                  DELCLF=G15.7MAIN
     5/57H TOUCHDOWN WING PLUS FLAT LIFT COEFFICIENT        CLTDF =G15.7MAIN
     5/57H TOUCHDOWN BODY ANGLE (DEG)                       ATD   =G15.7MAIN
     5/57H TOUCHDOWN WING LIFT COEFFICIENT                  CLTD  =G15.7MAIN
     5/57H TOUCHDOWN SPEED (KNOTS)                          VTD   =G15.7MAIN
     5/57H SPEED AT OBSTACLE (KNOTS)                        V50   =G15.7MAIN
     *)                                                                 MAIN
      WRITE(6,7)                                                        MAIN
     1CL50, CD50, CDTD, CDLG, CDG, XAIR, ROS, GAM50, XG, VSTAL, CLG,    MAIN
     2CDCHUT                                                            MAIN
    7 FORMAT(                                                           MAIN
     8 57H LIFT COEFFICIENT AT OBSTACLE                     CL50  =G15.7MAIN
     1/57H DRAG COEFFICIENT AT OBSTACLE                     CD50  =G15.7MAIN
     1/57H DRAG COEFFICIENT AT TOUCHDOWN                    CDTD  =G15.7MAIN
     1/57H DRAG COEFFICIENT OF LANDING GEAR                 CDLG  =G15.7MAIN
     1/57H DRAG COEFFICIENT DURING GROUND ROLL              CDG   =G15.7MAIN
     4/57H AIR DISTANCE (FT)                                XAIR  =G15.7MAIN
     4/57H RATE OF SINK  AT OBSTACLE (FPS)                  ROS   =G15.7MAIN
     5/57H FLIGHT PATH ANGLE AT OBSTACLE (DEG)              GAM50 =G15.7MAIN
     7/57H GROUND ROLL DISTANCE (FT)                        XG    =G15.7MAIN
     4/57H POWER OFF STALL SPEED (KNOTS)                    VSTAL =G15.7MAIN
     7/57H GROUND ROLL LIFT COEFIICIENT                     CLG   =G15.7MAIN
     7/57H DRAG COEFFICIENT OF THE CHUTE                    CDCHUT=G15.7MAIN
     *)                                                                 MAIN
      VSTALL = VSTAL                                                    MAIN
      GAM50L = GAM50                                                    MAIN
      XAIRL = XAIR                                                      MAIN
      XGL = XG                                                          MAIN
      V50L = V50                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE LINES(LCOUNT)                                          MAIN
C     **************************************                            MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG(538), LONG  )                                  MAIN
C     LCOUNT = NUMBER OF LINES TO BE PRINTED                            MAIN
C     **************************************                            MAIN
      LONG=LONG+LCOUNT                                                  MAIN
      IF(LONG.LE.52) RETURN                                             MAIN
      CALL PAGHED                                                       MAIN
      LONG=LCOUNT                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE LISTZL                                                 MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG( 81), CASEN )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      INTEGER CASE, CASEN, PSET                                         MAIN
      CALL SYMBOL(11.5, 8.2, 0.14, 7HCASE  =, 0.0, 7)                   MAIN
      V = FLOAT(CASE)                                                   MAIN
      CALL NUMBER(12.48, 8.2, 0.14, V, 0.0, 0)                          MAIN
      CALL SYMBOL(11.5, 8.0, 0.14, 7HCASEN =, 0.0, 7)                   MAIN
      V = FLOAT(CASEN)                                                  MAIN
      CALL NUMBER(12.48, 8.0, 0.14, V, 0.0, 0)                          MAIN
      CALL SYMBOL(11.5, 7.8, 0.14, 7HPSET  =, 0.0, 7)                   MAIN
      V = FLOAT(PSET)                                                   MAIN
      CALL NUMBER(12.48, 7.8, 0.14, V, 0.0, 0)                          MAIN
      CALL SYMBOL(11.5, 7.6, 0.14, 7HWEIGHT=, 0.0, 7)                   MAIN
      V = WT                                                            MAIN
      CALL NUMBER(12.48, 7.6, 0.14, V, 0.0, 0)                          MAIN
      CALL SYMBOL(11.5, 7.4, 0.14, 7HGLEVEL=, 0.0, 7)                   MAIN
      V=GLEVEL                                                          MAIN
      CALL NUMBER(12.48, 7.4, 0.14, V, 0.0, 3)                          MAIN
      CALL SYMBOL(11.5,7.2,.14,7HZMAX  =,0.0,7)                         MAIN
      V=ZMAX                                                            MAIN
      CALL NUMBER(12.48,7.2,.14,V,0.0,3)                                MAIN
      CALL SYMBOL(11.5,7.0,.14,7HZMIN  =,0.0,7)                         MAIN
      V=ZMIN                                                            MAIN
      CALL NUMBER(12.48,7.0,.14,V,0.0,3)                                MAIN
      ZMAX=-1000000.                                                    MAIN
      ZMIN=1000000.                                                     MAIN
      CALL SYMBOL(11.5,6.8,0.14,7HZCUTS =,0.0,7)                        MAIN
      H=6.8                                                             MAIN
      DO 10 I=1,NZ                                                      MAIN
      N = 1                                                             MAIN
      ZABS = ABS(ZCUTS(I))                                              MAIN
      IF(ZABS .GT. 0)  N = ALOG10(ZABS)                                 MAIN
      N = IABS(N -5)                                                    MAIN
      IF(N .GT. 10) N = 10                                              MAIN
      CALL NUMBER(12.48, H, 0.14, ZCUTS(I), 0.0, N)                     MAIN
      H = H -0.20                                                       MAIN
   10 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PATH                                                   MAIN
      COMMON/FWDREV/REVFLG                                              MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE  (XNSEG(732),AINLET),(XNSEG(748),AMAXTJ)              MAIN
      EQUIVALENCE  (XNSEG(749),AMINRJ),(XNSEG(766),TJFACT)              MAIN
      EQUIVALENCE  (XNSEG(764),IASCAL)                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 73), AN    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 87), DMC   )                                  MAIN
      EQUIVALENCE (XNSEG( 88), ERRFP )                                  MAIN
      EQUIVALENCE (XNSEG( 89), ERRH  )                                  MAIN
      EQUIVALENCE (XNSEG( 90), ERRM  )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(111), RCM   )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(120), TOL   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(123), W     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(129), XA0   )                                  MAIN
      EQUIVALENCE (XNSEG(130), XA1   )                                  MAIN
      EQUIVALENCE (XNSEG(131), XA2   )                                  MAIN
      EQUIVALENCE (XNSEG(132), XA3   )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(157), YZA   )                                  MAIN
      EQUIVALENCE (XNSEG(160), ZX6   )                                  MAIN
      EQUIVALENCE (XNSEG(161), ZX7   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(1),ASPEED),(ATMOS(4),DPDH),(ATMOS(5),PR),      MAIN
     3(ATMOS( 9),QMSQR ),                                               MAIN
     1(ATMOS(14),TR),(ATMOS(3),DTDH)                                    MAIN
      INTEGER PSET, PSETH                                               MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              PROVIDES INSTANTANEOUS CONDITIONS WHEN LIFT              MAIN
C                  DOES NOT EQUAL WEIGHT                                MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C**** CLIMB THRUST WILL REDUCED IF REQUIRED TO FOLLOW                   MAIN
C     THE DESIRED V-H SCHEDULE.                                         MAIN
C**** FOR A DESCENT (YZA=-1.0) THRUST WILL BE INCREASED                 MAIN
      CALL ATMOSD                                                       MAIN
      NFP=XQFP                                                          MAIN
      GO TO (11, 12, 13, 14), NFP                                       MAIN
11    QPATH=XB0+XB1*H                                                   MAIN
      AM=SQRT (QPATH/(1481.352*PR))                                     MAIN
      DMDH=-0.5*AM*DPDH/PR+XB1/(2.*AM*PR*1481.352)                      MAIN
      GO TO 14                                                          MAIN
12    AM=XA0+XA1*H+XA2*H**2.+XA3*H**3.                                  MAIN
      DMDH=XA1+2.*XA2*H+3.*XA3*H**2.                                    MAIN
      GO TO 14                                                          MAIN
   13 AM=DMC                                                            MAIN
      DMDH=0.0                                                          MAIN
 14   V=AM*ASPEED                                                       MAIN
      SQTR=ASPEED                                                       MAIN
      VX=V                                                              MAIN
      QS=XQSW*1481.352*PR*AM**2                                         MAIN
      CALL ENDAT                                                        MAIN
      DVDH=V*DTDH/(2.0*TR)+SQTR*DMDH                                    MAIN
      SX=0.0                                                            MAIN
C                        ...   ...   ...   ...                          MAIN
      I36 = 0                                                           MAIN
      I26 = 0                                                           MAIN
      DO 20 I=1,10                                                      MAIN
      SX1=SX                                                            MAIN
      CL=(W/QS)*SQRT(1.0-SX*SX)                                         MAIN
      CALL DRAG                                                         MAIN
      IF(ZX6.GT.0.01) WT=WT-ZX7                                         MAIN
   26 XXK1 = FN - DRT                                                   MAIN
      XXK2 = W*( V*DVDH/32.2 + 1.0 )                                    MAIN
      SX = XXK1/XXK2                                                    MAIN
      SCHECK = SX*YZA*REVFLG                                            MAIN
      GAM7D = 90. * YZA *REVFLG                                         MAIN
      IF(ABS(SX) .LT. 1.0)                                              MAIN
     1GAM7D = ASIN(SX)*57.29577951                                      MAIN
      I26 = I26 +1                                                      MAIN
      IF(I26 .GT. 100)  GO TO 1000                                      MAIN
C                                                                       MAIN
      IF( (ABS(XXK2).GT.ABS(XXK1) ).AND. (SCHECK.GT.0.0) ) GO TO 21     MAIN
C                                                                       MAIN
C                                                                       MAIN
 36   PSETH=PSET                                                        MAIN
      I36 = I36 +1                                                      MAIN
      IF(I36 .GT. 100)  GO TO 1000                                      MAIN
      IF( ABS(XXK2) .GT.0.01*WT ) GO TO 361                             MAIN
      WRITE(6,362)  XXK2,DRT                                            MAIN
  362 FORMAT(1H0,5X,* V-H PROFILE TOO SENSITIVE -- ACCEL TERM LT ONE PERMAIN
     1CENT OF DRAG *, 2(2X,G10.3) )                                     MAIN
      GO TO 2                                                           MAIN
  361 CONTINUE                                                          MAIN
      WRITE(6,1234)                                                     MAIN
 1234 FORMAT(1H0,5X,*THROTTLING NECESSARY TO ACHIEVE CLIMB OR DESCENT   MAIN
     1PATH .  GAMMA ARBITRARILY SET AT ONE DEGREE.*)                    MAIN
      WRITE(6,1235)  FN,DRT,W,V,DVDH,SX                                 MAIN
 1235 FORMAT(1H ,*PATH---F-NET,DRAG,WT,VEL,DVDH,SIN GAM *,6(1X,G11.4))  MAIN
C     MIN CLIMB ANGLE IF THROTTLING REQD IS ONE DEGREE                  MAIN
      GAM7D = 1.0*YZA*REVFLG                                            MAIN
      SX = 0.01745 *YZA*REVFLG                                          MAIN
      CL = (W/QS)*0.99985                                               MAIN
      CALL DRAG                                                         MAIN
      PS=DRT+SX*W*(V*DVDH/32.2+1.0)                                     MAIN
      IF(PS.LT.0.0) GO TO 2                                             MAIN
C     COMPUTE RATE OF CLIMB                                             MAIN
      RC = V*SX                                                         MAIN
 25   PSETH=PSET                                                        MAIN
      PSET=1                                                            MAIN
      PH=PS                                                             MAIN
      CALL ENDAT                                                        MAIN
      PS=PH                                                             MAIN
 31   PSET=0                                                            MAIN
      TSET=PS/FN                                                        MAIN
      IF(TSET.LE.1.0 ) GO TO 40                                         MAIN
      IF(IASCAL.EQ.0)  GO TO 40                                         MAIN
C     AUTOMATIC ENGINE SCALING                                          MAIN
      IF(AM.LE.AMAXTJ) TJFACT = TJFACT*TSET                             MAIN
      IF(AM.GE.AMINRJ) AINLET = AINLET*TSET                             MAIN
      PSCAL = (TSET - 1.0) * 100.                                       MAIN
      WRITE (6,32) PSCAL,TJFACT,AINLET                                  MAIN
   32 FORMAT(1H0,5X,* ENGINE SCALED UP BY *,F7.3,*PERCENT.  TURBOJET SCAMAIN
     1LING FACTOR = *,F7.3,* INLET AREA = *,F7.3,* SQ. FT.*)            MAIN
   40 CONTINUE                                                          MAIN
      CALL ENDAT                                                        MAIN
      AN=1.56236*YZA                                                    MAIN
      PSET=PSETH                                                        MAIN
C                                                                       MAIN
      WRITE(6,27)TSET,AM,H,YZA                                          MAIN
   27 FORMAT(1H0,*CLIMB THRUST CHANGED TO*,F6.3,                        MAIN
     111H MAX. POWER,6HMACH =F6.3,10HALTITUDE =F7.0,5HYZA =F4.0)        MAIN
      IF( (TSET.GE.1.0) .OR. (TSET.LE.0.0) ) GO TO 2                    MAIN
      GO TO 17                                                          MAIN
C                                                                       MAIN
   21 CONTINUE                                                          MAIN
C     SIGN GAMMA IS CONSISTANT WITH CLIMB OR DESCENT -- ITERATE TO      MAIN
C     MAKE GAMMA CONSISTANT WITH DRAG.                                  MAIN
C     COMPUTE RATE OF CLIMB                                             MAIN
      RC=V*SX                                                           MAIN
      IF(RC*YZA*REVFLG.LT.0.0)  GO TO 500                               MAIN
      ERR=ABS(SX-SX1)                                                   MAIN
      IF(ERR .LT. TOL)  GO TO 17                                        MAIN
   20 CONTINUE                                                          MAIN
C                        ...   ...   ...   ...                          MAIN
      ERRM=AM                                                           MAIN
      ERRH=H                                                            MAIN
      ERRFP=FLPN                                                        MAIN
 17   AN=ATAN(SX/SQRT(1.0-SX*SX))                                       MAIN
 24   VX=V*COS(AN)                                                      MAIN
      VN=VX*.59208                                                      MAIN
      RCM=RC*60.                                                        MAIN
      FFR=FFR/3600.                                                     MAIN
      XNZZ=1.0                                                          MAIN
      GO TO 900                                                         MAIN
C     ...                                                               MAIN
    2 CONTINUE                                                          MAIN
      VX=0.                                                             MAIN
      GAM7D = 90.*YZA*REVFLG                                            MAIN
      AN=1.57080*YZA*REVFLG                                             MAIN
      SFC=0.0                                                           MAIN
      RC=V*YZA*0.99997                                                  MAIN
      FFR=0.0                                                           MAIN
C                                                                       MAIN
      SX=.99*YZA*REVFLG                                                 MAIN
      WRITE(6,3) AM,H,WT,DVDH                                           MAIN
 3    FORMAT(73HCLIMB SCHEDULE CANNOT BE MEET. ASSUME VERTICAL CLIMB WITMAIN
     *H ZERO FUEL FLOW./                                                MAIN
     1  7H MACH =,F7.3,11H ALTITUDE =,F8.0,5H WT =,F10.0,7H DVDH =,E12.3MAIN
     2)                                                                 MAIN
      GO TO 17                                                          MAIN
C                                                                       MAIN
 500  XNZZ=2.0                                                          MAIN
  900 CONTINUE                                                          MAIN
      IF(IPXX(4))  CALL OUTXXX(4)                                       MAIN
      RETURN                                                            MAIN
 1000 CONTINUE                                                          MAIN
      IF(IPXX(4))  CALL OUTXXX(4)                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RGSAVE(RG, TZ)                                         MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      REAL RG(1), TZ(1)                                                 MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(232), TCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(233), RCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(578), IPRGSV)                                  MAIN
      RG(ITZ) = WT                                                      MAIN
      RG(ITZ +1) = H                                                    MAIN
      RG(ITZ +2) = AM                                                   MAIN
      RG(ITZ +3) =   TAC+TTC+TTR+TCMAX                                  MAIN
      FUEL=ABS(WTKEP-WT)                                                MAIN
      RG(ITZ +4) = FUEL                                                 MAIN
      RG(ITZ +5) =   RN+RXC+DAC+RCMAX                                   MAIN
      RG(ITZ +6) = XNZZ                                                 MAIN
      NOPT=TZ(ITZ+7)                                                    MAIN
C     OPTION 22 USES EIGHTH LOC IN RG ARRAY TO STORE ITERATION COUNTER  MAIN
      IF(NOPT.EQ.22)  GO TO 50                                          MAIN
      RG(ITZ +7) = E10                                                  MAIN
   50 CONTINUE                                                          MAIN
      RG(ITZ +8) = E11                                                  MAIN
      RG(ITZ +9) = TZ(ITZ+7)                                            MAIN
      IF(IPRGSV .EQ. 0)  RETURN                                         MAIN
      L = ITZ-1                                                         MAIN
      WRITE(6,100) ITZ, (RG(L+K), K=1,10)                               MAIN
  100  FORMAT(8H0 RGSAVE/1X, 3HITZ, 10X, 2HWT, 11X, 1HH, 10X, 2HAM, 6X, MAIN
     1       6HTAC+++, 8X, 4HFUEL, 6X, 6HRUN+++,  8X, 4HXNZZ, 3X, 3HE10,MAIN
     2       3X, 3HE11, 1X, 6HOPTION/1X, I3, 7G12.4, 2F6.0, I6//)       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX22(TZ,RG,NSR)                                      MAIN
      REAL  RG(1)                                                       MAIN
      REAL  TZ(1)                                                       MAIN
      COMMON /COMSEG/  XNSEG(775)                                       MAIN
      EQUIVALENCE  (XNSEG(233),RCMAX),(XNSEG(232),TCMAX)                MAIN
      EQUIVALENCE  (XNSEG( 113),RN),(XNSEG(119),TTR)                    MAIN
      EQUIVALENCE  (XNSEG(86),DAC),(XNSEG(117),TAC)                     MAIN
      EQUIVALENCE  (XNSEG(114),RXC),(XNSEG(118),TTC)                    MAIN
      EQUIVALENCE  (XNSEG(237),ITZ),(XNSEG(124),WT)                     MAIN
      EQUIVALENCE  (XNSEG(234),RANGE),(XNSEG(72 ),AMACH)                MAIN
      EQUIVALENCE  (XNSEG(235),TIME )                                   MAIN
      EQUIVALENCE  (XNSEG( 94),ALT  ),(XNSEG(117),TAC )                 MAIN
      DIMENSION ID(5)                                                   MAIN
      DATA KMAX /3/                                                     MAIN
      DATA KPASS/0/,ID /6HWEIGHT,6H RANGE,6H  MACH,6H      ,6H      /   MAIN
      IF(TZ(ITZ+8).GT. 0.)  KMAX = TZ(ITZ+8)                            MAIN
C     PICK UP ITERATION COUNTER FOR THIS SEGMENT                        MAIN
      KPASS=RG(ITZ+7)                                                   MAIN
      NSR=0                                                             MAIN
      IF(KPASS.GE.KMAX) RETURN                                          MAIN
      LOCI = TZ(ITZ+3)*10 - 9                                           MAIN
      LOCF = TZ(ITZ+4)*10 - 9                                           MAIN
      IVAR = TZ(ITZ)                                                    MAIN
      JVAR = TZ(ITZ+1)                                                  MAIN
      IF(JVAR.EQ.1 ) ENDVAL = WT                                        MAIN
      IF(JVAR.EQ.2 ) ENDVAL = RANGE                                     MAIN
      IF(JVAR.EQ.3 ) ENDVAL = AMACH                                     MAIN
C     WEIGHT IS I.C.                                                    MAIN
      IF(IVAR.EQ.1)  KTZ=2                                              MAIN
C     RANGE  IS I.C.                                                    MAIN
      IF(IVAR.EQ.2) KTZ =4                                              MAIN
C     MACH  IS  I.C.                                                    MAIN
      IF(IVAR.EQ.3) KTZ = 0                                             MAIN
      XVAL = TZ( LOCI + KTZ)                                            MAIN
C                                                                       MAIN
C                                                                       MAIN
      IF(IVAR.EQ.0) GO TO 400                                           MAIN
      IF(KPASS.GT.0) GO TO 100                                          MAIN
C     DETERMINE VARIATION OF VARIABLE PARAMETER FOR FIRST PASS          MAIN
      FRACT=0.                                                          MAIN
C     WEIGHT--WEIGHT                                                    MAIN
      IF( (IVAR.EQ.1).AND.(JVAR.EQ.1) )  FRACT =1.0                     MAIN
C     RANGE -- WEIGHT                                                   MAIN
C     EXAMPLE---FLY SPECIFIED RANGE IN AN EARLIER SEGMENT AND SATISFY   MAIN
C     CURRENT WEIGHT                                                    MAIN
      IF( (IVAR.EQ.2).AND.(JVAR.EQ.1) )  FRACT = .02                    MAIN
C     WEIGHT -- RANGE                                                   MAIN
      IF( (IVAR.EQ.1) .AND. (JVAR.EQ.2) ) FRACT = 50.0                  MAIN
C     RANGE --  RANGE                                                   MAIN
      IF( (IVAR.EQ.2) .AND. (JVAR.EQ.2) )  FRACT = 1.0                  MAIN
      XSAV=0.                                                           MAIN
      ENDSAV=0.                                                         MAIN
      DELTX = ( TZ(ITZ +2) - ENDVAL ) * FRACT                           MAIN
      GO TO 200                                                         MAIN
  100 CONTINUE                                                          MAIN
      DELTY = TZ(ITZ+2) - ENDVAL                                        MAIN
      IF( ABS(DELTY).LE.(0.001*ABS(TZ(ITZ+2))) )  RETURN                MAIN
      DOT = ( ENDVAL - ENDSAV) / ( XVAL - XSAV)                         MAIN
      DELTX =  DELTY/DOT                                                MAIN
  200 CONTINUE                                                          MAIN
      IF(IVAR.EQ.0) GO TO 400                                           MAIN
      WRITE (6,300)                                                     MAIN
  300 FORMAT(1H0,5X,*INDEP. VAR.   LAST VAL   CURRENT VAL  DEP. VAR   LAMAIN
     1ST VAL   CURRENT VAL   DESIRED VAL * )                            MAIN
      DVAL = TZ(ITZ+2)                                                  MAIN
      WRITE (6,301)  ID(IVAR),XSAV,XVAL,ID(JVAR),ENDSAV,ENDVAL,DVAL     MAIN
  301 FORMAT(1H0,5X,A10,G12.4,G14.4,A10,G11.4,G12.4,G12.4 )             MAIN
      ENDSAV = ENDVAL                                                   MAIN
      XSAV = XVAL                                                       MAIN
      XVAL = XVAL + DELTX                                               MAIN
      WRITE(6,305)  XVAL                                                MAIN
  305 FORMAT(1H0,5X,* NEXT VALUE OF INDEPENDENT VARIABLE = *,G15.6)     MAIN
      TZ(LOCI + KTZ) = XVAL                                             MAIN
  400 CONTINUE                                                          MAIN
C     REINITIALIZE FLIGHT PARAMETERS FOR STARTING SEGMENT FROM RG ARRAY MAIN
C                                                                       MAIN
C                                                                       MAIN
      LOCR = LOCI - 10                                                  MAIN
      AMACH =  RG(LOCR + 2)                                             MAIN
      WT    =  RG(LOCR)                                                 MAIN
      ALT   =  RG(LOCR + 1)                                             MAIN
      LOWSEG = TZ(ITZ+3) - 1                                            MAIN
      TIME = 0.                                                         MAIN
      RANGE= 0.                                                         MAIN
      IF (LOWSEG.LE.2) GO TO 11                                         MAIN
      DO 10 I=2,LOWSEG                                                  MAIN
      KR=10*(I-1)+6                                                     MAIN
      KT=10*(I-1)+4                                                     MAIN
      RANGE = RANGE + RG(KR)                                            MAIN
   10 TIME  = TIME  + RG(KT)                                            MAIN
   11 CONTINUE                                                          MAIN
      KPASS = KPASS + 1                                                 MAIN
      RG(ITZ+7)=KPASS                                                   MAIN
      CALL DUMPTZ(TZ)                                                   MAIN
      WRITE(6,415)                                                      MAIN
      CALL DUMPRG(RG)                                                   MAIN
      WRITE(6,415)                                                      MAIN
  415 FORMAT(1H1)                                                       MAIN
      RCMAX=0.                                                          MAIN
      TCMAX=0.                                                          MAIN
      RN=0.                                                             MAIN
      TTR=0.                                                            MAIN
      DAC=0.                                                            MAIN
      TAC=0.                                                            MAIN
      RXC=0.                                                            MAIN
      TTC=0.                                                            MAIN
      NSR=1                                                             MAIN
      ITZ=LOCI - 10                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAPOUT(TOPT, NCTT)                                     MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      EQUIVALENCE (XNSEG(  4), PLTHD)                                   MAIN
      EQUIVALENCE (XNSEG(663), ZLTAB )                                  MAIN
      EQUIVALENCE (XNSEG(688), INDZLT)                                  MAIN
      EQUIVALENCE (XNSEG(689), Z11MAP)                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      REAL ZLTAB(25)                                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      REAL PLTHD(3)                                                     MAIN
      PLOTPC = 0.0                                                      MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 21) (XMESH(I), I=1,NX)                                   MAIN
   21 FORMAT(14H0 MACH NUMBERS/ (10G12.4))                              MAIN
      WRITE(6, 22) (YMESH(I), I=1,NY)                                   MAIN
   22 FORMAT(11H0 ALTITUDES/ (10G12.4))                                 MAIN
      WRITE(6, 30) (AMLO(I), I=1,NY)                                    MAIN
   30 FORMAT(38H0 MINIMUM MACH NUMBERS FOR CLMAX LIMIT/ (10G12.4))      MAIN
      WRITE(6, 31) (AMHI(I), I=1,NY)                                    MAIN
   31 FORMAT(38H0 MAXIMUM MACH NUMBERS FOR MAX Q LIMIT/ (10G12.4))      MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,26) TOPT, ZMAX, ZMIN                                      MAIN
   26 FORMAT(1H0, 20X, 3A10, 20X,                                       MAIN
     1       9H  ZMAX = G12.4, 10X, 8H ZMIN = G12.4)                    MAIN
      DO 24 J=1,NY                                                      MAIN
      WRITE(6, 20) YMESH(J)                                             MAIN
   20 FORMAT(1H0/ 50X, 12H ALTITUDE = G12.4)                            MAIN
      WRITE(6,23) (ZMESH(I,J), I=1,NX)                                  MAIN
   23 FORMAT(1H0/(10G12.4))                                             MAIN
   24 CONTINUE                                                          MAIN
      Z11MAP = ZMESH(1,1)                                               MAIN
      IF(ZMAX .LE. ZMIN)  RETURN                                        MAIN
      DELZ=(ZMAX-ZMIN)*.01*PLOTPC                                       MAIN
      DZ=(ZMAX-ZMIN-2.0*DELZ)/FLOAT(NZ-1)                               MAIN
      ZLEVEL=ZMIN+DELZ-DZ                                               MAIN
      DO 40 I=1,NZ                                                      MAIN
      ZLEVEL=ZLEVEL+DZ                                                  MAIN
      ZCUTS(I)=ZLEVEL                                                   MAIN
      IF(INDZLT .EQ. 1)  ZCUTS(I) = ZLTAB(I)                            MAIN
   40 CONTINUE                                                          MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6, 41) TOPT, (ZCUTS(I), I=1,NZ)                             MAIN
   41 FORMAT(11H0 ZCUTS FOR, 3A10/ (10G12.4))                           MAIN
      CALL CONPLT(12H MACH NUMBER, 12, 10H ALTITUDE , 10)               MAIN
C     PLOT MAX Q LINE                                                   MAIN
      CALL QBOUND(AMHI)                                                 MAIN
C     PLOT CLMAX LINE                                                   MAIN
      CALL QBOUND(AMLO)                                                 MAIN
      CALL SYMBOL(3.5,9.0,0.21,PLTHD,0.0,30)                            MAIN
      CALL SYMBOL(3.5, 8.2, 0.21, TOPT, 0.0, NCTT)                      MAIN
      CALL LISTZL                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP01                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE(XNSEG(699),INDCLA)                                    MAIN
      EQUIVALENCE(XNSEG(701),ALPHAD)                                    MAIN
      EQUIVALENCE(XNSEG(660),INDCLM)                                    MAIN
      EQUIVALENCE(XNSEG(693),AMLOW )                                    MAIN
      EQUIVALENCE(XNSEG(704),ARG   )                                    MAIN
      EQUIVALENCE (XNSEG(271),INDA43)                                   MAIN
      EQUIVALENCE (XNSEG(709),CT   )                                    MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 1), ASPEED)                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      EQUIVALENCE(ATMOS(12), SPEED )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10HSPECIFIC E,10HXCESS POWE,10HR (FT/SEC)/             MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1)AMLO(J)=AMLOW                                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      IF(INDA43.NE.3) CALL DRAG                                         MAIN
      CALL ENDAT                                                        MAIN
      SPEED = AM*ASPEED                                                 MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
      CT=FN/QS                                                          MAIN
      IF(INDCLA.LT.1) GO TO 5                                           MAIN
      CALL ALPTAB                                                       MAIN
      IF(INDCLA.EQ.1) GO TO 4                                           MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
4     CALL DRAG                                                         MAIN
      EDOT=(FN*COS(ARG)-(DRT))*SPEED/WT                                 MAIN
5     CONTINUE                                                          MAIN
      ZMESH(I,J) = EDOT                                                 MAIN
      IF(EDOT .GT. ZMAX)  ZMAX = EDOT                                   MAIN
      IF(EDOT .LT. ZMIN)  ZMIN = EDOT                                   MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      ZMIN = 0.0                                                        MAIN
      NCTT=30                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP02                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE(XNSEG(699),INDCLA)                                    MAIN
      EQUIVALENCE(XNSEG(701),ALPHAD)                                    MAIN
      EQUIVALENCE(XNSEG(660),INDCLM)                                    MAIN
      EQUIVALENCE(XNSEG(693),AMLOW )                                    MAIN
      EQUIVALENCE(XNSEG(704),ARG   )                                    MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 1), ASPEED)                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      EQUIVALENCE(ATMOS(12), SPEED )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H ENERGY EX,10HCHANGE FAC,10HTOR(FT/LB)/             MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1)AMLO(J)=AMLOW                                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      SPEED = AM*ASPEED                                                 MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
      EDOMD = EDOT*3600.0/FFR                                           MAIN
      IF(INDCLA.LT.1) GO TO 5                                           MAIN
      CALL ALPTAB                                                       MAIN
      IF(INDCLA.EQ.1) GO TO 4                                           MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
4     CALL DRAG                                                         MAIN
      EDOT=(FN*COS(ARG)-(DRT))*SPEED/WT                                 MAIN
      EDOMD=EDOT*3600.0/FFR                                             MAIN
5     CONTINUE                                                          MAIN
      ZMESH(I,J) = EDOMD                                                MAIN
      IF(EDOMD .GT. ZMAX)  ZMAX = EDOMD                                 MAIN
      IF(EDOMD .LT. ZMIN)  ZMIN = EDOMD                                 MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      IF(ZMIN .LT. 0.0)  ZMIN = 0.0                                     MAIN
      NCTT=30                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP03                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(699),INDCLA)                                   MAIN
      EQUIVALENCE (XNSEG(701),ALPHAD)                                   MAIN
      EQUIVALENCE (XNSEG(660),INDCLM)                                   MAIN
      EQUIVALENCE (XNSEG(693),AMLOW )                                   MAIN
      EQUIVALENCE (XNSEG(704),ARG   )                                   MAIN
      EQUIVALENCE (XNSEG( 92),FN    )                                   MAIN
      EQUIVALENCE(XNSEG( 98),PSET  )                                    MAIN
      EQUIVALENCE (XNSEG(271),INDA43)                                   MAIN
      EQUIVALENCE (XNSEG(709),CT   )                                    MAIN
      EQUIVALENCE (XNSEG(710),CTMAX)                                    MAIN
      INTEGER PSET                                                      MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      REAL LIFT, LOD                                                    MAIN
      DATA TOPT /10H LIFT/DRAG, 10H     (PWD , 10HOR UNPWD) /           MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1)AMLO(J)=AMLOW                                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      LIFT = WT*GLEVEL                                                  MAIN
      CL = LIFT/QS                                                      MAIN
      IF(INDCLA.LT.1) GO TO 5                                           MAIN
      IF (INDA43.NE.3) GO TO 9                                          MAIN
      ARG=0.                                                            MAIN
      INDX=0                                                            MAIN
      PS=.01*QS                                                         MAIN
  7   CALL ENDAT                                                        MAIN
      CT=FN/QS                                                          MAIN
      CL=CL+(FN*SIN(ARG)/QS)                                            MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      IF (CT.GE.CTMAX) GO TO 8                                          MAIN
      S=DRT/(QS*COS(ARG))                                               MAIN
      IF(CT.GE.S.OR.INDX.GT.7) GO TO 8                                  MAIN
      CT=S*1.005                                                        MAIN
      IF(CT.GE.CTMAX) CT=CTMAX                                          MAIN
      INDX=INDX+1                                                       MAIN
      PS=CT*QS                                                          MAIN
      GO TO 7                                                           MAIN
  9   CALL DRAG                                                         MAIN
      PS=DRT                                                            MAIN
      FN=0.0                                                            MAIN
      IF(PSET.EQ.0) CALL ENDAT                                          MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      PS=DRT/COS(ARG)                                                   MAIN
      IF(PSET.EQ.0) CALL ENDAT                                          MAIN
      CL=CL+(FN*SIN(ARG)/QS)                                            MAIN
      CALL ALPTAB                                                       MAIN
  8   IF (INDCLA.EQ.1) GO TO 4                                          MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
 4    LIFT=CL*QS                                                        MAIN
 5    CONTINUE                                                          MAIN
C     IF INDCLA=1,2,COMPUTES ALPHA EFFECTS                              MAIN
C     IF PSET=0 PROVIDES AERODYNAMIC L/D ACHIEVED IN POWERED FLIGHT     MAIN
C     IF PSET.NE.0 OR INDCLA.EQ.0 LIFT/DRAG IS FOR UNPOWERED CASE       MAIN
      CALL DRAG                                                         MAIN
      LOD = LIFT/DRT                                                    MAIN
      ZMESH(I,J) = LOD                                                  MAIN
      IF(LOD  .GT. ZMAX)  ZMAX = LOD                                    MAIN
      IF(LOD  .LT. ZMIN)  ZMIN = LOD                                    MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT=30                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP04                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(192), VELA  )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE(XNSEG(699),INDCLA)                                    MAIN
      EQUIVALENCE(XNSEG(701),ALPHAD)                                    MAIN
      EQUIVALENCE(XNSEG(660),INDCLM)                                    MAIN
      EQUIVALENCE(XNSEG(693),AMLOW )                                    MAIN
      EQUIVALENCE(XNSEG(704),ARG   )                                    MAIN
      EQUIVALENCE (XNSEG(709),CT   )                                    MAIN
      EQUIVALENCE (XNSEG(710),CTMAX)                                    MAIN
      EQUIVALENCE (XNSEG(271),INDA43)                                   MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL LIFT                                                         MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H RANGE FAC, 10HTOR  (N.MI, 10H/LB) PSET0/           MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1)AMLO(J)=AMLOW                                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      LIFT = WT*GLEVEL                                                  MAIN
      CL = LIFT/QS                                                      MAIN
      IF (INDA43.NE.3) GO TO 9                                          MAIN
      ARG=0.                                                            MAIN
      INDX=0                                                            MAIN
      VEL=AM*VELA                                                       MAIN
      PS=.01*QS                                                         MAIN
  7   CALL ENDAT                                                        MAIN
      CT=FN/QS                                                          MAIN
      CL=CL+(FN*SIN(ARG)/QS)                                            MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      IF (CT.GE.CTMAX) GO TO 8                                          MAIN
      S=DRT/(QS*COS(ARG))                                               MAIN
      IF(CT.GE.S.OR.INDX.GT.7) GO TO 8                                  MAIN
      CT=S*1.005                                                        MAIN
      IF(CT.GE.CTMAX) CT=CTMAX                                          MAIN
      INDX=INDX+1                                                       MAIN
      PS=CT*QS                                                          MAIN
      GO TO 7                                                           MAIN
  9   CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      VEL = AM*VELA                                                     MAIN
      RF=VEL/(SFC*DRT)                                                  MAIN
      ZMESH(I,J) = RF                                                   MAIN
      IF(INDCLA.LT.1) GO TO 5                                           MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      PS=DRT/COS(ARG)                                                   MAIN
      CALL ENDAT                                                        MAIN
      CL=CL+(FN*SIN(ARG)/QS)                                            MAIN
      CALL ALPTAB                                                       MAIN
  8   IF(INDCLA.EQ.1) GO TO 4                                           MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
C     PSET MUST BE 0                                                    MAIN
4     CALL DRAG                                                         MAIN
      RF=VEL/(SFC*DRT/COS(ARG))                                         MAIN
      ZMESH(I,J)=RF                                                     MAIN
5     CONTINUE                                                          MAIN
      IF(RF   .GT. ZMAX)  ZMAX = RF                                     MAIN
      IF(RF .LE. 0.0)  GO TO 10                                         MAIN
      IF(RF   .LT. ZMIN)  ZMIN = RF                                     MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT=30                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP05                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE(XNSEG(699),INDCLA)                                    MAIN
      EQUIVALENCE(XNSEG(701),ALPHAD)                                    MAIN
      EQUIVALENCE(XNSEG(660),INDCLM)                                    MAIN
      EQUIVALENCE(XNSEG(693),AMLOW )                                    MAIN
      EQUIVALENCE(XNSEG(704),ARG   )                                    MAIN
      EQUIVALENCE(XNSEG( 98),PSET  )                                    MAIN
      INTEGER PSET                                                      MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H THRUST RE,10HQUIRED  (L,10HBS) PSET=0/             MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1) AMLO(J)=AMLOW                                     MAIN
C     FOR T=D ACCOUNTING FOR THRUST COMPONENTS USE PSET=0,INDCLA=1,2    MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      IF(INDCLA.LT.1.OR.PSET.NE.0) GO TO 5                              MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      PS=DRT/COS(ARG)                                                   MAIN
      CALL ENDAT                                                        MAIN
      CL=CL+(FN*SIN(ARG)/QS)                                            MAIN
      CALL ALPTAB                                                       MAIN
      IF(INDCLA.EQ.1) GO TO 4                                           MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
4     CALL DRAG                                                         MAIN
      FN=DRT/COS(ARG)                                                   MAIN
5     CONTINUE                                                          MAIN
      ZMESH(I,J) = FN                                                   MAIN
      IF(FN   .GT. ZMAX)  ZMAX = FN                                     MAIN
      IF(FN   .LT. ZMIN)  ZMIN = FN                                     MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT=30                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP06                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(699),INDCLA)                                   MAIN
      EQUIVALENCE (XNSEG(701),ALPHAD)                                   MAIN
      EQUIVALENCE (XNSEG(660),INDCLM)                                   MAIN
      EQUIVALENCE (XNSEG(693),AMLOW )                                   MAIN
      EQUIVALENCE (XNSEG(704),ARG   )                                   MAIN
      EQUIVALENCE (XNSEG( 92),FN    )                                   MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL LIFT, LOD                                                    MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H DRAG    (,10HLBS) UNPOW,5HERED /                   MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1) AMLO(J)=AMLOW                                     MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      LIFT = WT*GLEVEL                                                  MAIN
      CL = LIFT/QS                                                      MAIN
      IF(INDCLA.LT.1) GO TO 4                                           MAIN
      FN=0.0                                                            MAIN
      CALL ALPTAB                                                       MAIN
      IF(INDCLA.EQ.1) GO TO 4                                           MAIN
      ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
4     CONTINUE                                                          MAIN
      CALL DRAG                                                         MAIN
      ZMESH(I,J) = DRT                                                  MAIN
      IF(DRT  .GT. ZMAX)  ZMAX = DRT                                    MAIN
      IF(DRT  .LT. ZMIN)  ZMIN = DRT                                    MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT=25                                                           MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP07                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(693),AMLOW )                                   MAIN
      EQUIVALENCE (XNSEG(660),INDCLM)                                   MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 1), ASPEED)                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      EQUIVALENCE(ATMOS(12), SPEED )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H SPECIFIC , 10HFUEL CONSU, 10HMPTION MAP/           MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1)AMLO(J)=AMLOW                                      MAIN
C     MAP NOT RIGGED TO COMPUTE ALPHA EFFECTS                           MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      SPEED = AM*ASPEED                                                 MAIN
      ZMESH(I,J) = SFC                                                  MAIN
      IF(SFC  .GT. ZMAX)  ZMAX = SFC                                    MAIN
      IF(SFC  .LT. ZMIN)  ZMIN = SFC                                    MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT = 30                                                         MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP08                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(660),INDCLM)                                   MAIN
      EQUIVALENCE (XNSEG(693),AMLOW )                                   MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 8), Q     )                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H FUEL FLOW, 10H RATE MAP , 1H /                     MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1) AMLO(J)=AMLOW                                     MAIN
C     MAP NOT RIGGED TO COMPUTE ALPHA EFFECTS                           MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      ZMESH(I,J) = FFR                                                  MAIN
      IF(FFR   .GT. ZMAX)  ZMAX = FFR                                   MAIN
      IF(FFR   .LT. ZMIN)  ZMIN = FFR                                   MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT = 19                                                         MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP09                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE(ATMOS( 9), QMSQR )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H SPECIFIC , 10HENERGY MAP, 1H /                     MAIN
C     MAP NOT RIGGED FOR CLMTAB OR CLATAB                               MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      SPEED = AM*ASPEED                                                 MAIN
      SE = H +SPEED**2/64.4                                             MAIN
      ZMESH(I,J) = SE                                                   MAIN
      IF(SE   .GT. ZMAX)  ZMAX = SE                                     MAIN
      IF(SE   .LT. ZMIN)  ZMIN = SE                                     MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      NCTT = 20                                                         MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP10                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     2       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(655), ZMAX10)                                  MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL LIFT, LOTMD                                                  MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H LIFT/(THR, 10HUST -DRAG), 1H /                     MAIN
C     MAP NOT RIGGED FOR CLMTAB OR CLATAB                               MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      Q = QMSQR*AM**2                                                   MAIN
      QS = Q*XQSW                                                       MAIN
      CL = (WT/QS)*GLEVEL                                               MAIN
      LIFT = CL*QS                                                      MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      LOTMD = LIFT/(FN -DRT)                                            MAIN
      IF(LOTMD .LE. 0.0)  LOTMD = 10.0*ZMAX10                           MAIN
      ZMESH(I,J) = LOTMD                                                MAIN
      IF(LOTMD .GT. ZMAX)  ZMAX = LOTMD                                 MAIN
      IF(LOTMD .LT. ZMIN)  ZMIN = LOTMD                                 MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      IF(ZMAX .GT. ZMAX10)  ZMAX = ZMAX10                               MAIN
      NCTT = 20                                                         MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP11                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(653), INDTRN)                                  MAIN
      EQUIVALENCE (XNSEG(656), ZMAX11)                                  MAIN
      EQUIVALENCE (XNSEG(690), GLIMIT)                                  MAIN
      EQUIVALENCE(XNSEG(699),INDCLA)                                    MAIN
      EQUIVALENCE(XNSEG(701),ALPHAD)                                    MAIN
      EQUIVALENCE(XNSEG(660),INDCLM)                                    MAIN
      EQUIVALENCE(XNSEG(693),AMLOW )                                    MAIN
      EQUIVALENCE(XNSEG(704),ARG   )                                    MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT /10H TURN RADI, 10HUS   (FT) , 1H /                     MAIN
      IF(GLIMIT .LE. 0.0)  GLIMIT = 3.5                                 MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1) AMLO(J)=AMLOW                                     MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      SPEED = AM*ASPEED                                                 MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CLGLIM = WT*GLIMIT/QS                                             MAIN
      CL=CLGLIM                                                         MAIN
      ARG=0.0                                                           MAIN
      FN=0.0                                                            MAIN
      CALL CLMX                                                         MAIN
      CALL ALPTAB                                                       MAIN
      CALL ENDAT                                                        MAIN
      TCOMP=FN*SIN(ARG)/QS                                              MAIN
      CLGLIM=CLGLIM+TCOMP                                               MAIN
      CLM=CLMAX+TCOMP                                                   MAIN
      CLSTAR=AMIN1(CLM,CLGLIM)                                          MAIN
      IF(INDTRN.EQ.1) GO TO 8                                           MAIN
      CALL DRAG                                                         MAIN
      IF(FN*COS(ARG).GE.DRT) GO TO 8                                    MAIN
      DELCL=.2*CLSTAR                                                   MAIN
      CLSAVE=0.0                                                        MAIN
      DO 4 ICL=1,5                                                      MAIN
      CL=CLSAVE+DELCL                                                   MAIN
      CLSAVE=CL                                                         MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      X2=(FN*COS(ARG))-DRT                                              MAIN
      IF(X2.GT.0.0) GO TO 4                                             MAIN
      DELCL=.025*CLSTAR                                                 MAIN
      CLSTAR=CLSAVE                                                     MAIN
      DO 3 JCL=1,7                                                      MAIN
      CL=CLSTAR-DELCL                                                   MAIN
      CLSTAR=CL                                                         MAIN
      CALL ALPTAB                                                       MAIN
      IF(CL.LT.0.0) CL=0.0                                              MAIN
      CALL DRAG                                                         MAIN
      X2=(FN*COS(ARG))-DRT                                              MAIN
      IF(X2.GE.0.0) GO TO 8                                             MAIN
3     CONTINUE                                                          MAIN
      GO TO 8                                                           MAIN
4     CONTINUE                                                          MAIN
      CLSTAR=CLSAVE                                                     MAIN
      GO TO 8                                                           MAIN
7     ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
8     CONTINUE                                                          MAIN
      IF(INDCLA.EQ.2) GO TO 7                                           MAIN
      FACTOR = (QS*CLSTAR)**2 -WT**2                                    MAIN
      IF(FACTOR .GT. 0.0)  GO TO 9                                      MAIN
      ZMESH(I,J) = 1.0E36                                               MAIN
      GO TO 10                                                          MAIN
    9 CONTINUE                                                          MAIN
      FACTOR = 32.2*SQRT(FACTOR)                                        MAIN
      TURNR = WT*SPEED**2/FACTOR                                        MAIN
      ZMESH(I,J) = TURNR                                                MAIN
      IF(TURNR .GT. ZMAX)  ZMAX = TURNR                                 MAIN
      IF(TURNR .LT. ZMIN)  ZMIN = TURNR                                 MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      ZSTAR = ZMAX*1.001                                                MAIN
      DO 40 J=1,NY                                                      MAIN
      DO 30 I=1,NX                                                      MAIN
      IF(ZMESH(I,J) .GT. ZMAX)  ZMESH(I,J) = ZSTAR                      MAIN
   30 CONTINUE                                                          MAIN
   40 CONTINUE                                                          MAIN
      NCTT = 19                                                         MAIN
      IF(ZMAX .GT. ZMAX11)  ZMAX = ZMAX11                               MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MAP12                                                  MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      EQUIVALENCE (XNSEG(653), INDTRN)                                  MAIN
      EQUIVALENCE (XNSEG(657), ZMAX12)                                  MAIN
      EQUIVALENCE (XNSEG(690), GLIMIT)                                  MAIN
      EQUIVALENCE (XNSEG(699),INDCLA)                                   MAIN
      EQUIVALENCE (XNSEG(701),ALPHAD)                                   MAIN
      EQUIVALENCE (XNSEG(660),INDCLM)                                   MAIN
      EQUIVALENCE (XNSEG(693),AMLOW )                                   MAIN
      EQUIVALENCE (XNSEG(704),ARG   )                                   MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      REAL TOPT(3)                                                      MAIN
      DATA TOPT/10H TURN RATE, 10H   (DEG/SE, 8HC)      /               MAIN
      DATA PI /3.141592654/                                             MAIN
      IF(GLIMIT .LE. 0.0)  GLIMIT = 3.5                                 MAIN
      DO 20 J=1,NY                                                      MAIN
      H = H +DELH                                                       MAIN
      YMESH(J) = H                                                      MAIN
      CALL ATMOSD                                                       MAIN
      AMHI(J) = SQRT(QLIM/QMSQR)                                        MAIN
      AMLO(J) = SQRT(WT/(QMSQR*CLMAX*XQSW)*GLEVEL)                      MAIN
      CALL MAXLFT                                                       MAIN
      IF(INDCLM.EQ.1) AMLO(J)=AMLOW                                     MAIN
      AM = XLOW -DELAM                                                  MAIN
      DO 10 I=1,NX                                                      MAIN
      AM = AM +DELAM                                                    MAIN
      XMESH(I) = AM                                                     MAIN
      SPEED = AM*ASPEED                                                 MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CLGLIM = WT*GLIMIT/QS                                             MAIN
      CL=CLGLIM                                                         MAIN
      ARG=0.0                                                           MAIN
      FN=0.0                                                            MAIN
      CALL CLMX                                                         MAIN
      CALL ALPTAB                                                       MAIN
      CALL ENDAT                                                        MAIN
      TCOMP=FN*SIN(ARG)/QS                                              MAIN
      CLGLIM=CLGLIM+TCOMP                                               MAIN
      CLM=CLMAX+TCOMP                                                   MAIN
      CLSTAR=AMIN1(CLM,CLGLIM)                                          MAIN
      IF(INDTRN.EQ.1) GO TO 8                                           MAIN
      CALL DRAG                                                         MAIN
      IF(FN*COS(ARG).GE.DRT) GO TO 8                                    MAIN
      DELCL=.2*CLSTAR                                                   MAIN
      CLSAVE=0.0                                                        MAIN
      DO 4 ICL=1,5                                                      MAIN
      CL=CLSAVE+DELCL                                                   MAIN
      CLSAVE=CL                                                         MAIN
      CALL ALPTAB                                                       MAIN
      CALL DRAG                                                         MAIN
      X2=(FN*COS(ARG))-DRT                                              MAIN
      IF(X2.GT.0.0) GO TO 4                                             MAIN
      DELCL=.025*CLSTAR                                                 MAIN
      CLSTAR=CLSAVE                                                     MAIN
      DO 3 JCL=1,7                                                      MAIN
      CL=CLSTAR-DELCL                                                   MAIN
      CLSTAR=CL                                                         MAIN
      CALL ALPTAB                                                       MAIN
      IF(CL.LT.0.0) CL=0.0                                              MAIN
      CALL DRAG                                                         MAIN
      X2=(FN*COS(ARG))-DRT                                              MAIN
      IF(X2.GE.0.0) GO TO 8                                             MAIN
 3    CONTINUE                                                          MAIN
      GO TO 8                                                           MAIN
 4    CONTINUE                                                          MAIN
      CLSTAR=CLSAVE                                                     MAIN
      GO TO 8                                                           MAIN
 7    ZMESH(I,J)=ALPHAD                                                 MAIN
      IF(ALPHAD.GT.ZMAX) ZMAX=ALPHAD                                    MAIN
      IF(ALPHAD.LT.ZMIN) ZMIN=ALPHAD                                    MAIN
      GO TO 10                                                          MAIN
 8    CONTINUE                                                          MAIN
      IF(INDCLA.EQ.2) GO TO 7                                           MAIN
      FACTOR = (QS*CLSTAR)**2 -WT**2                                    MAIN
      IF(FACTOR .GT. 0.0)  GO TO 9                                      MAIN
      ZMESH(I,J) = 1.0E36                                               MAIN
      GO TO 10                                                          MAIN
    9 CONTINUE                                                          MAIN
      FACTOR = 32.2*SQRT(FACTOR)                                        MAIN
      TURNR = WT*SPEED**2/FACTOR                                        MAIN
C     TURN RATE IN DEG PER SEC                                          MAIN
      TIMTRN=180.*SPEED/(PI*TURNR)                                      MAIN
      ZMESH(I,J) = TIMTRN                                               MAIN
      IF(TIMTRN .GT. ZMAX)  ZMAX = TIMTRN                               MAIN
      IF(TIMTRN .LT. ZMIN)  ZMIN = TIMTRN                               MAIN
   10 CONTINUE                                                          MAIN
   20 CONTINUE                                                          MAIN
      ZSTAR=0.0                                                         MAIN
      DO 40 J=1,NY                                                      MAIN
      DO 30 I=1,NX                                                      MAIN
      IF(ZMESH(I,J) .GT. ZMAX)  ZMESH(I,J) = ZSTAR                      MAIN
   30 CONTINUE                                                          MAIN
   40 CONTINUE                                                          MAIN
      IF(ZMAX .GT. ZMAX12)  ZMAX = ZMAX12                               MAIN
      NCTT = 28                                                         MAIN
      CALL MAPOUT(TOPT, NCTT)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MDCLMB                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      NAME LIST /DBMDOT/ I, K, AMS, H0, AME, HE, WT, DELW,              MAIN
     1                   EDOT1                                          MAIN
      DATA TWOG /64.4/                                                  MAIN
      CALL INIMHP                                                       MAIN
      NUMAM = 20                                                        MAIN
      DELAM = (AME -AMS)/NUMAM                                          MAIN
      K = 1                                                             MAIN
      DO 100 I=1,NUMAM                                                  MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT1 = (FN -DRT)*SPEED/WT                                        MAIN
      SE = H0 +SPEED**2/TWOG                                            MAIN
      DELE = (DELAM*ASPEED)**2/TWOG                                     MAIN
      DELW = FFR*DELE /(3600.0*EDOT1)                                   MAIN
      AME = AMS +DELAM                                                  MAIN
      CALL MDHPT (WT-DELW, HE, AME, SE)                                 MAIN
      IF(SE  .GT. 0.0)  GO TO 2                                         MAIN
      WRITE(6, DBMDOT)                                                  MAIN
      GO TO 100                                                         MAIN
    2 CONTINUE                                                          MAIN
      CALL FLYMHP                                                       MAIN
      H0 = HE                                                           MAIN
      AMS = AME                                                         MAIN
  100 CONTINUE                                                          MAIN
      AME = ENDPT(1)                                                    MAIN
      HE = ENDPT(2)                                                     MAIN
      CALL FLYMHP                                                       MAIN
      CALL MHPTAB(3)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MHPATH(INTEQ)                                          MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      AMPATH(KPATH +1) = XMESH(NX +1)                                   MAIN
      AMPATH(KPATH +2) = XMESH(NX +2)                                   MAIN
      HPATH(KPATH+2)=YMESH(NY+2)                                        MAIN
      HPATH(KPATH+1)=YMESH(NY+1)                                        MAIN
      CALL LINE(AMPATH, HPATH, KPATH, 1, 1, INTEQ)                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE MDHPT (WT, HPT, AMPT, SELAST)                          MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      COMMON /COMSEG/ XNSEG(400)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(191), VEL   )                                  MAIN
      EQUIVALENCE (XNSEG(192), VELA  )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(658), EDOT  )                                  MAIN
      REAL LIFT                                                         MAIN
      REAL LOD, LOD1, LOD2, LOD3                                        MAIN
      REAL LOTMD, LOTMD1, LOTMD2, LOTMD3                                MAIN
      REAL Y(5)                                                         MAIN
      COMMON /YICSET/       Y1(5), Y2(5), Y3(5)                         MAIN
      EQUIVALENCE (Y(5), LOTMD)                                         MAIN
      EQUIVALENCE (Y(1), EDOT), (Y(2), EDOMD), (Y(3), LOD), (Y(4), RF)  MAIN
      EQUIVALENCE (Y1(1), EDOT1 ), (Y2(1), EDOT2 ), (Y3(1), EDOT3 )     MAIN
      EQUIVALENCE (Y1(2), EDOMD1), (Y2(2), EDOMD2), (Y3(2), EDOMD3)     MAIN
      EQUIVALENCE (Y1(3), LOD1  ), (Y2(3), LOD2  ), (Y3(3), LOD3  )     MAIN
      EQUIVALENCE (Y1(4), RF1   ), (Y2(4), RF2   ), (Y3(4), RF3   )     MAIN
      EQUIVALENCE (Y1(5), LOTMD1), (Y2(5), LOTMD2), (Y3(5), LOTMD3)     MAIN
      LOGICAL MGIVEN                                                    MAIN
      NAME LIST /DBHPT/ J, JJ, HGC7F1, HGC7F2, HGC7F3,                  MAIN
     1                  VEL, H, AM, HGC7FO, YMAX, INDMHP, Y, Y1, Y2, Y3,MAIN
     2                  COEFA, COEFB, COEFC, WT, SE, HPT, AMPT,         MAIN
     3                  CL, DRT, FN, Q, QS, QLIM, AMLIM                 MAIN
      DATA TWOG /64.4/                                                  MAIN
      LIFT = WT                                                         MAIN
      CALL SETYIC(Y)                                                    MAIN
      YMAX = -0.0                                                       MAIN
      HGC7F1 = -0.0                                                     MAIN
      HGC7F2 = -0.0                                                     MAIN
      HGC7F3 = -0.0                                                     MAIN
      HGC7FO = -0.0                                                     MAIN
      COEFA = -0.0                                                      MAIN
      COEFB = -0.0                                                      MAIN
      COEFC = -0.0                                                      MAIN
      JJ = 0                                                            MAIN
      MGIVEN = .TRUE.                                                   MAIN
      AM = AMPT                                                         MAIN
      DELH = ENDPT(2)/20.0                                              MAIN
      H = -DELH                                                         MAIN
      DO 50 J=1,21                                                      MAIN
      H = H +DELH                                                       MAIN
      CALL ATMOSD                                                       MAIN
      VEL = 0.5921*SPEED                                                MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      SE = H +SPEED**2/TWOG                                             MAIN
      IF(SE .LT. SELAST)  GO TO 50                                      MAIN
      IF(CL .GT. CLMAX)  GO TO 50                                       MAIN
      IF(Q .GT. QLIM)  GO TO 50                                         MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
C     IF(EDOT .LE. 0.0)  GO TO 50                                       MAIN
      EDOMD = EDOT*3600.0/FFR                                           MAIN
      LOD = LIFT/DRT                                                    MAIN
      RF = (LIFT/DRT)*(VEL/SFC)                                         MAIN
      LOTMD = LIFT/(FN -DRT)                                            MAIN
      IF(Y(INDMHP) .LT. Y2(INDMHP))  GO TO 50                           MAIN
      EDOT2 = EDOT                                                      MAIN
      EDOMD2 = EDOMD                                                    MAIN
      LOD2 = LOD                                                        MAIN
      RF2 = RF                                                          MAIN
      LOTMD2 = LOTMD                                                    MAIN
      HGC7F2 = H                                                        MAIN
      AMQ2 = SQRT(QLIM/QMSQR)                                           MAIN
   50 CONTINUE                                                          MAIN
C     COMPUTE MACH ALTITUDE POINT FOR THIS SPECIFIC ENERGY              MAIN
      HGC7F1 = HGC7F2 -DELH                                             MAIN
      HGC7F3 = HGC7F2 +DELH                                             MAIN
      H = HGC7F3                                                        MAIN
      CALL ATMOSD                                                       MAIN
      AMQ3 = SQRT(QLIM/QMSQR)                                           MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT3 = (FN -DRT)*SPEED/WT                                        MAIN
      EDOMD3 = EDOT3*3600.0/FFR                                         MAIN
      LOD3 = LIFT/DRT                                                   MAIN
      RF3 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD3 = LIFT/(FN -DRT)                                           MAIN
      H = HGC7F1                                                        MAIN
      CALL ATMOSD                                                       MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      IF(Q .LE. QLIM)  GO TO 55                                         MAIN
      AMQ1 = SQRT(QLIM/QMSQR)                                           MAIN
      CALL XFIT2(AMQ1, AMQ2, AMQ3, HGC7F1, HGC7F2, HGC7F3,              MAIN
     1           COEFA, COEFB, COEFC, DUM1, DUM2, DUM3, DUM4)           MAIN
      HGC7F1 = COEFA +AM*(COEFB +AM*COEFC)                              MAIN
      H = HGC7F1                                                        MAIN
      GO TO 65                                                          MAIN
   55 CONTINUE                                                          MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT1 = (FN -DRT)*SPEED/WT                                        MAIN
      EDOMD1 = EDOT1*3600.0/FFR                                         MAIN
      LOD1 = LIFT/DRT                                                   MAIN
      RF1 = (LIFT/DRT)*(VEL/SFC)                                        MAIN
      LOTMD1 = LIFT/(FN -DRT)                                           MAIN
      CALL XFIT2(HGC7F1, HGC7F2, HGC7F3,                                MAIN
     1           Y1(INDMHP), Y2(INDMHP), Y3(INDMHP),                    MAIN
     2           COEFA, COEFB, COEFC,                                   MAIN
     3           HGC7FO, YMAX, DUM, DUM)                                MAIN
      H = HGC7FO                                                        MAIN
   65 CONTINUE                                                          MAIN
      IF(H .LE. 0.0)  H = 0.0                                           MAIN
      HPT = H                                                           MAIN
      CALL ATMOSD                                                       MAIN
      Q = 0.5*RHO*SPEED**2                                              MAIN
      QS = Q*XQSW                                                       MAIN
      CL = WT/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      PS = DRT                                                          MAIN
      CALL ENDAT                                                        MAIN
      EDOT = (FN -DRT)*SPEED/WT                                         MAIN
      IF(CL .GT. CLMAX)  GO TO 200                                      MAIN
      IF(Q .GT. 1.01*QLIM)  GO TO 200                                   MAIN
C     IF(EDOT .GT. 0.0)  RETURN                                         MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      WRITE(6, DBHPT)                                                   MAIN
      MGIVEN = .TRUE.                                                   MAIN
      WRITE(6, 100)                                                     MAIN
  100 FORMAT(64H0 WARNING   ***   THE VEHICLE CAN NOT FLY AT THE ABOVE CMAIN
     1ONDITION)                                                         MAIN
      SELAST = -0.0                                                     MAIN
      HPT = H0                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NDATA1                                                 MAIN
      COMMON /DICNAM/ LCOUNT, NAME(504), LOC(504)                       MAIN
C                                                                       MAIN
C                                                                       MAIN
      DATA (NAME(I), I=1,126)  /                                        MAIN
     *6HXMLOD ,6HXFLEN ,6HXMSEG ,6HNCASE ,6HAMTO  ,6HHTO   ,6HWGTO  ,   MAIN
     *6HFF    ,6HFPOL  ,6HOWE   ,6HAREFF ,6HNSTOR1,6HNSTOR2,6HNSTOR3,   MAIN
     *6HWGTS1 ,6HWGTS2 ,6HWGTS3 ,6HWGTSP1,6HWGTSP2,6HWGTSP3,6HIDRSP1,   MAIN
     *6HIDRSP2,6HIDRSP3,6HJDRPS1,6HJDRPS2,6HJDRPS3,6HNTANK1,6HNTANK2,   MAIN
     *6HNTANK3,6HWGTT1 ,6HWGTT2 ,6HWGTT3 ,6HWGTFT1,6HWGTFT2,6HWGTFT3,   MAIN
     *6HWGTTP1,6HWGTTP2,6HWGTTP3,6HIDRTP1,6HIDRTP2,6HIDRTP3,6HIPLF1 ,   MAIN
     *6HIPLF2 ,6HIPLF3 ,6HPLWINT,6HBAREWT,6HAM    ,6HAN    ,6HACG   ,   MAIN
     *6HACV   ,6HAME   ,6HAMS   ,6HAVSFC ,6HCL    ,6HCASE  ,6HCASEN ,   MAIN
     *6HCLZZ  ,6HCLC   ,6HCLCD  ,6HDRT   ,6HDAC   ,6HDMC   ,6HERRFP ,   MAIN
     *6HERRH  ,6HERRM  ,6HFFR   ,6HFN    ,6HFWC   ,6HH     ,6HHE    ,   MAIN
     *6HH0    ,6HPS    ,6HPSET  ,6HPQ1   ,6HPQ2   ,6HPQ3   ,6HPQ4   ,   MAIN
     *6HPQ5   ,6HPQ6   ,6HPQ7   ,6HPQ8   ,6HPQ9   ,6HPQ10  ,6HQS    ,   MAIN
     *6HRC    ,6HRCM   ,6HRFAC  ,6HRN    ,6HRXC   ,6HSFC   ,6HSQ    ,   MAIN
     *6HTAC   ,6HTTC   ,6HTTR   ,6HTOL   ,6HVN    ,6HVX    ,6HW     ,   MAIN
     *6HWT    ,6HW1    ,6HW2    ,6HXQSW  ,6HXAA   ,6HXA0   ,6HXA1   ,   MAIN
     *6HXA2   ,6HXA3   ,6HXB0   ,6HXB1   ,6HXNZZ  ,6HXQAE  ,6HXQA1  ,   MAIN
     *6HXQWE  ,6HXQWW  ,6HXQBD  ,6HXQFP  ,6HXQR1  ,6HXQR2  ,6HXQR3  ,   MAIN
     *6HXQT1  ,6HXQT2  ,6HXQT3  ,6HXQW1  ,6HXQW2  ,6HXSTEP ,6HXTT   /   MAIN
C                                                                       MAIN
      DATA ( LOC(I), I=1,126)  /                                        MAIN
     *1       ,2       ,3       ,29      ,30      ,31      ,32      ,   MAIN
     *33      ,34      ,35      ,36      ,37      ,38      ,39      ,   MAIN
     *40      ,41      ,42      ,43      ,44      ,45      ,46      ,   MAIN
     *47      ,48      ,49      ,50      ,51      ,52      ,53      ,   MAIN
     *54      ,55      ,56      ,57      ,58      ,59      ,60      ,   MAIN
     *61      ,62      ,63      ,64      ,65      ,66      ,67      ,   MAIN
     *68      ,69      ,70      ,71      ,72      ,73      ,74      ,   MAIN
     *75      ,76      ,77      ,78      ,79      ,80      ,81      ,   MAIN
     *82      ,83      ,84      ,85      ,86      ,87      ,88      ,   MAIN
     *89      ,90      ,91      ,92      ,93      ,94      ,95      ,   MAIN
     *96      ,97      ,98      ,99      ,100     ,101     ,102     ,   MAIN
     *103     ,104     ,105     ,106     ,107     ,108     ,109     ,   MAIN
     *110     ,111     ,112     ,113     ,114     ,115     ,116     ,   MAIN
     *117     ,118     ,119     ,120     ,121     ,122     ,123     ,   MAIN
     *124     ,125     ,126     ,127     ,128     ,129     ,130     ,   MAIN
     *131     ,132     ,133     ,134     ,135     ,136     ,137     ,   MAIN
     *138     ,139     ,140     ,141     ,142     ,143     ,144     ,   MAIN
     *145     ,146     ,147     ,148     ,149     ,150     ,151     /   MAIN
C                                                                       MAIN
C                                                                       MAIN
      DATA (NAME(I), I=127,252)  /                                      MAIN
     *6HAVOID1,6HAVOID2,6HISEG  ,6HMAXSEG,6HNUMSEG,6HYZA   ,6HZX9   ,   MAIN
     *6HZX5   ,6HZX6   ,6HZX7   ,6HZX8   ,6HZY1   ,6HZY2   ,6HZY3   ,   MAIN
     *6HZY4   ,6HZY5   ,6HZY6   ,6HZY7   ,6HZY8   ,6HZY9   ,6HZY10  ,   MAIN
     *6HA1    ,6HE10   ,6HINDATM,6HATMOS ,6HE11   ,6HCLMAX ,6HAMLIM ,   MAIN
     *6HQLIM  ,6HDELWT ,6HNWT   ,6HDELAM ,6HWUTO  ,6HAMF   ,6HDELH  ,   MAIN
     *6HNH    ,6HWI    ,6HWFF   ,6HNAM   ,6HAMI   ,6HHI    ,6HCDDELT,   MAIN
     *6HRCSC  ,6HAVOID ,6HPAYWT ,6HAOUT  ,6HFUEL  ,6HFUELTO,6HFUELTK,   MAIN
     *6HFUELIN,6HFUELUS,6HTSWT  ,6HWGTUF1,6HWGTUF2,6HWGTUF3,6HWTKEP ,   MAIN
     *6HTCMAX ,6HRCMAX ,6HRANGE ,6HTIME  ,6HZX10  ,6HITZ   ,6HNSDROP,   MAIN
     *6HSTYP1 ,6HSTYP2 ,6HSTYP3 ,6HSPTYP1,6HSPTYP2,6HSPTYP3,6HTOTSWD,   MAIN
     *6HNDROP1,6HNDROP2,6HNDROP3,6HMDROP1,6HMDROP2,6HMDROP3,6HJDRPT1,   MAIN
     *6HJDRPT2,6HJDRPT3,6HTOTTWD,6HTOTTFD,6HTTYP1 ,6HTTYP2 ,6HTTYP3 ,   MAIN
     *6HTPTYP1,6HTPTYP2,6HTPTYP3,6HINDAER,6HCD    ,6HCDSTOR,6HCDTANK,   MAIN
     *6HIPDICN,6HINDA40,6HINDA41,6HINDA42,6HINDA43,6HINDA44,6HINDA45,   MAIN
     *6HIA40X ,6HIA40Y ,6HIA41X ,6HIA41Y ,6HIA42X ,6HIA42Y ,6HIA43X ,   MAIN
     *6HIA43Y ,6HIA44X ,6HIA44Y ,6HIA45X ,6HIA45Y ,6HINDA46,6HINDA47,   MAIN
     *6HINDA48,6HINDA49,6HINDA50,6HINDA51,6HINDA52,6HINDA53,6HINDA54,   MAIN
     *6HINDA55,6HINDA56,6HINDA57,6HINDA58,6HINDA59,6HINDA60,6HIA46X /   MAIN
C                                                                       MAIN
      DATA ( LOC(I), I=127,252)  /                                      MAIN
     *152     ,153     ,154     ,155     ,156     ,157     ,158     ,   MAIN
     *159     ,160     ,161     ,162     ,163     ,164     ,165     ,   MAIN
     *166     ,167     ,168     ,169     ,170     ,171     ,172     ,   MAIN
     *173     ,174     ,175     ,176     ,196     ,197     ,198     ,   MAIN
     *199     ,200     ,201     ,202     ,203     ,204     ,205     ,   MAIN
     *206     ,207     ,208     ,209     ,210     ,211     ,212     ,   MAIN
     *218     ,219     ,220     ,221     ,222     ,223     ,224     ,   MAIN
     *225     ,226     ,227     ,228     ,229     ,230     ,231     ,   MAIN
     *232     ,233     ,234     ,235     ,236     ,237     ,238     ,   MAIN
     *239     ,240     ,241     ,242     ,243     ,244     ,245     ,   MAIN
     *246     ,247     ,248     ,249     ,250     ,251     ,252     ,   MAIN
     *253     ,254     ,255     ,256     ,257     ,258     ,259     ,   MAIN
     *260     ,261     ,262     ,263     ,264     ,265     ,266     ,   MAIN
     *267     ,268     ,269     ,270     ,271     ,272     ,273     ,   MAIN
     *274     ,275     ,276     ,277     ,278     ,279     ,280     ,   MAIN
     *281     ,282     ,283     ,284     ,285     ,286     ,287     ,   MAIN
     *288     ,289     ,290     ,291     ,292     ,293     ,294     ,   MAIN
     *295     ,296     ,297     ,298     ,299     ,300     ,301     /   MAIN
C                                                                       MAIN
C                                                                       MAIN
      DATA (NAME(I), I=253,378)  /                                      MAIN
     *6HIA46Y ,6HIA47X ,6HIA47Y ,6HIA48X ,6HIA48Y ,6HINDA01,6HINDA02,   MAIN
     *6HINDA03,6HINDA04,6HINDA05,6HINDA06,6HINDA07,6HINDA08,6HINDA09,   MAIN
     *6HINDA10,6HINDA11,6HINDA12,6HTSIZEF,6HNUMENG,6HSFCFAC,6HTHRMIN,   MAIN
     *6HFFLMIN,6HHOVTMI,6HHOVSFC,6HHOVT  ,6HTHROTT,6HWUTOFU,6HTEWT  ,   MAIN
     *6HTFWT  ,6HTPWT  ,6HPAIRS ,6HTZ13  ,6HRANGE1,6HRANGE2,6HRANGE3,   MAIN
     *6HFUEL1 ,6HFUEL2 ,6HFUEL3 ,6HOPTION,6HSTWRET,6HSTWDRP,6HTSWRET,   MAIN
     *6HTSWDRP,6HFUELT1,6HFUELT2,6HFUELT3,6HRETWGT,6HIPXX  ,6HLOCTZ ,   MAIN
     *6HLOCRG ,6HLOCNG ,6HXQ12  ,6HIPATMD,6HHG    ,6HTM    ,6HPM    ,   MAIN
     *6HNHG   ,6HLOCSAC,6HDATE  ,6HNPAGE ,6HIHR   ,6HMIN   ,6HISEC  ,   MAIN
     *6HLOCTFF,6HINDT01,6HINDT02,6HINDT03,6HINDT04,6HINDT05,6HINDT06,   MAIN
     *6HIT01X ,6HIT02X ,6HIT03X ,6HIT04X ,6HIT05X ,6HIT06X ,6HIT01Y ,   MAIN
     *6HIT02Y ,6HIT03Y ,6HIT04Y ,6HIT05Y ,6HIT06Y ,6HIT02W ,6HIT04W ,   MAIN
     *6HFFRMIN,6HFNMIN ,6HIPSEG ,6HIPTZIN,6HIPENDR,6HIPENDS,6HIPRGSV,   MAIN
     *6HIPTZXX,6HSREF  ,6HSPLG  ,6HCDPLG ,6HAG    ,6HAMAXG ,6HWINCID,   MAIN
     *6HARTHEO,6HWSLEFC,6HCLATOT,6HCL0   ,6HTRATIO,6HDFK   ,6HGRNDFT,   MAIN
     *6HCD0   ,6HWL    ,6HXMAXG ,6HBFOBEX,6HFLAPDT,6HCFOCAV,6HSPCHUT,   MAIN
     *6HCDPCHT,6HFNL   ,6HW0    ,6HFN0   ,6HXIS0  ,6HV50   ,6HW50   ,   MAIN
     *6HFLAPDL,6HGRNDFL,6HINDGPC,6HAMACH ,6HIPDGPC,6HGLEVEL,6HNUMCON/   MAIN
C                                                                       MAIN
      DATA ( LOC(I), I=253,378)  /                                      MAIN
     *302     ,303     ,304     ,305     ,306     ,307     ,308     ,   MAIN
     *309     ,310     ,311     ,312     ,313     ,314     ,315     ,   MAIN
     *316     ,317     ,318     ,319     ,320     ,321     ,322     ,   MAIN
     *323     ,324     ,325     ,326     ,327     ,328     ,329     ,   MAIN
     *330     ,331     ,332     ,333     ,334     ,335     ,336     ,   MAIN
     *337     ,338     ,339     ,340     ,341     ,342     ,343     ,   MAIN
     *344     ,345     ,346     ,347     ,348     ,349     ,359     ,   MAIN
     *360     ,361     ,362     ,363     ,364     ,389     ,414     ,   MAIN
     *439     ,440     ,490     ,491     ,492     ,493     ,494     ,   MAIN
     *495     ,516     ,517     ,518     ,519     ,520     ,521     ,   MAIN
     *522     ,523     ,524     ,525     ,526     ,527     ,528     ,   MAIN
     *529     ,530     ,531     ,532     ,533     ,534     ,535     ,   MAIN
     *536     ,537     ,539     ,575     ,576     ,577     ,578     ,   MAIN
     *579     ,583     ,584     ,585     ,586     ,587     ,588     ,   MAIN
     *589     ,590     ,591     ,592     ,593     ,594     ,595     ,   MAIN
     *596     ,597     ,598     ,599     ,600     ,601     ,602     ,   MAIN
     *603     ,604     ,605     ,606     ,607     ,608     ,609     ,   MAIN
     *610     ,611     ,612     ,613     ,622     ,623     ,637     /   MAIN
C                                                                       MAIN
C                                                                       MAIN
      CALL NDATA3                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NDATA2                                                 MAIN
      COMMON /TABNAM/ MAXT, TNAMES(126), LOCS(126), IS(126)             MAIN
      DATA TNAMES /                                                     MAIN
     *6HATAB01,6HATAB02,6HATAB03,6HATAB04,6HATAB07,6HATAB10,6HATAB11,   MAIN
     *6HATAB12,6HATAB13,6HATAB14,6HATAB17,6HATAB24,6HATAB25,6HATAB26,   MAIN
     *6HATAB27,6HATAB28,6HATAB31,6HATAB80,6HATAB90,6HATAB91,6HATAB92,   MAIN
     *6HATAB40,6HATAB41,6HATAB42,6HATAB43,6HATAB44,6HATAB45,6HATAB46,   MAIN
     *6HATAB47,6HATAB48,6HATAB49,6HATAB50,6HATAB51,6HATAB52,6HATAB53,   MAIN
     *6HATAB54,6HATAB55,6HATAB56,6HATAB57,6HATAB58,6HATAB59,6HATAB60,   MAIN
     *6HATAB05,6HATAB06,6HATAB08,6HATAB09,6HMTAB01,6HMTAB02,6HMTAB03,   MAIN
     *6HTTAB01,6HTTAB02,6HTTAB03,6HTTAB04,6HTTAB05,6HTTAB06,6HTTAB07,   MAIN
     *6HTTAB08,6HTTAB09,6HTTAB10,6HTTAB11,6HTTAB12,6HTTAB13,6HTTAB14,   MAIN
     *6HTTAB15,6HTTAB16,6HTTAB17,6HTTAB18,6HTTAB19,6HTTAB20,6HTTAB21,   MAIN
     *6HCLMTAB,6HCLATAB,6HETAB01,6HETAB02,6HETAB03,6HETAB04,6HETAB05,   MAIN
     *6HETAB06,6HETAB07,6HETAB08,6HETAB09,6HETAB10,6HCLZTAB,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     /   MAIN
C                                                                       MAIN
      MAXT = 83                                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NDATA4                                                 MAIN
      COMMON/COMSEG/XNSEG(710)                                          MAIN
      EQUIVALENCE(XNSEG(364),HG    )                                    MAIN
      EQUIVALENCE(XNSEG(389),TM    )                                    MAIN
      EQUIVALENCE(XNSEG(414),PM    )                                    MAIN
      EQUIVALENCE(XNSEG(439),NHG   )                                    MAIN
      REAL HG(25),TM(25),PM(25)                                         MAIN
      DATA NHG /11/                                                     MAIN
      DATA  HG( 1),   TM( 1),   PM( 1)    /                             MAIN
     1      -16404.0, 577.17, 3.7110839E+3/                             MAIN
      DATA  HG( 2),   TM( 2),   PM( 2)    /                             MAIN
     2           0.0, 518.67, 2.1162165E+3/                             MAIN
      DATA  HG( 3),   TM( 3),   PM( 3)    /                             MAIN
     3       36089.0, 389.97, 4.7267563E+2/                             MAIN
      DATA  HG( 4),   TM( 4),   PM( 4)    /                             MAIN
     4       65617.0, 389.97, 1.1434314E+2/                             MAIN
      DATA  HG( 5),   TM( 5),   PM( 5)    /                             MAIN
     5      104987.0, 411.57, 1.8128355E+1/                             MAIN
      DATA  HG( 6),   TM( 6),   PM( 6)    /                             MAIN
     6      154199.0, 487.17, 2.3162178   /                             MAIN
      DATA  HG( 7),   TM( 7),   PM( 7)    /                             MAIN
     7      170604.0, 487.17, 1.2321972   /                             MAIN
      DATA  HG( 8),   TM( 8),   PM( 8)    /                             MAIN
     8      200131.0, 454.77, 3.8030279E-1/                             MAIN
      DATA  HG( 9),   TM( 9),   PM( 9)    /                             MAIN
     9      259186.0, 325.17, 2.1671352E-2/                             MAIN
      DATA  HG(10),   TM(10),   PM(10)    /                             MAIN
     *      291160.0, 325.17, 3.4313478E-3/                             MAIN
      DATA  HG(11),   TM(11),   PM(11)    /                             MAIN
     *      295276.0, 379.17, 6.2773411E-4/                             MAIN
      DATA (HG(I), I=12,25) /14*0.0/                                    MAIN
      DATA (TM(I), I=12,25) /14*0.0/                                    MAIN
      DATA (PM(I), I=12,25) /14*0.0/                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NDTLU(ND,NA,X,Z,XA,ZR,IE,NEXTR)                        MAIN
C                                                                       MAIN
C     N-DIMENSIONAL TABLE LOOK-UP                                       MAIN
C                                                                       MAIN
C     GIVEN THE ARGUMENTS X(1),X(2),...X(N-1),                          MAIN
C           COMPUTES Y = F(X(1),X(2),...X(N-1)) BY                      MAIN
C           LINEAR INTERPOLATION FROM A TABLE.                          MAIN
C                                                                       MAIN
C     ACCURACY REAL SINGLE PRECISION                                    MAIN
C                                                                       MAIN
C                                                                       MAIN
C     CALLING SEQUENCE                                                  MAIN
C                                                                       MAIN
C     CALL LOOKUP(ND,NA,X,Z,XA,ZR,IE,NEXTR)                             MAIN
C     WHERE                                                             MAIN
C              ND  =  DIMENSION OF LOOK-UP                              MAIN
C                     WHEN Y=F(X) ND = 2                                MAIN
C                                                                       MAIN
C              NA  =  AN ARRAY OF LENGTH ND-1                           MAIN
C                     NUMBERS OF VALUES OF EACH TABLE OF X              MAIN
C                     THE TABLES ARE LISTED BY SIZE, THE LARGEST FIRST. MAIN
C                                                                       MAIN
C              X   =  TABLES OF EACH X IN ORDER                         MAIN
C              Z   =  FUNCTION VALUES                                   MAIN
C                     IF A = F(X,Y,Z) THE DEPENDENT VARIABLE ARRAY      MAIN
C                     MUST BE IN THE FOLLOWING ORDER.                   MAIN
C                     ASSUME X=4,4=3,Z=2                                MAIN
C              Z(2)= F(X2,Y1,Z1)       Z(14)= F(X2,Y1,Z2)               MAIN
C              Z(1)= F(X1,Y1,Z1)       Z(13)= F(X1,Y1,Z2)               MAIN
C              Z(3)= F(X3,Y1,Z1)       Z(15)= F(X3,Y1,Z2)               MAIN
C              Z(4)= F(X4,Y1,Z1)       Z(16)= F(X4,Y1,Z2)               MAIN
C              Z(5)= F(X1,Y2,Z1)       Z(17)= F(X1,Y2,Z2)               MAIN
C              Z(6)= F(X2,Y2,Z1)       Z(18)= F(X2,Y2,Z2)               MAIN
C              Z(7)= F(X3,Y2,Z1)       Z(19)= F(X3,Y2,Z2)               MAIN
C              Z(8)= F(X4,Y2,Z1)       Z(20)= F(X4,Y2,Z2)               MAIN
C              Z(9)= F(X1,Y3,Z1)       Z(21)= F(X1,Y3,Z2)               MAIN
C             Z(10)= F(X2,Y3,Z1)       Z(22)= F(X2,Y3,Z2)               MAIN
C             Z(11)= F(X3,Y3,Z1)       Z(23)= F(X3,Y3,Z2)               MAIN
C             Z(12)= F(X4,Y3,Z1)       Z(24)= F(X4,Y3,Z2)               MAIN
C                                                                       MAIN
C             ZR   =  RESULT                                            MAIN
C                                                                       MAIN
C           NEXTR  =  1  EXTRAPOLATE                                    MAIN
C                  =  0  NO  EXTRAPOLATION                              MAIN
C                                                                       MAIN
C             IE   =  ERROR CODE                                        MAIN
C                     0  NO ERROR                                       MAIN
C                    -1  X ARRAY TOO SMALL                              MAIN
C                     1  X ARRAY TOO LARGE                              MAIN
C                     2  ARRAY NOT IN ASCENDING ORDER                   MAIN
C                                                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
      DIMENSION X(1),Z(1),NA(1),XA(1),NS(5),WJ(32)                      MAIN
      EQUIVALENCE (XMM,MM) , (XMW,MW)                                   MAIN
      IE=0                                                              MAIN
      L1=2                                                              MAIN
      LF=ND-1                                                           MAIN
      DO 3 I=1,LF                                                       MAIN
      L2=L1+NA(I)-2                                                     MAIN
      FOUND=0.                                                          MAIN
      DO 4 J=L1,L2                                                      MAIN
      IF(X(J).GT.X(J-1)) GO TO 6                                        MAIN
      IE=2                                                              MAIN
      RETURN                                                            MAIN
 6    IF(FOUND.NE.0.) GO TO 4                                           MAIN
      IF(XA(I)-X(J-1)) 8,4,4                                            MAIN
 8    IF(J.GT.L1) GO TO 10                                              MAIN
      IF(NEXTR.EQ.0)  GO TO 37                                          MAIN
      FOUND=1.                                                          MAIN
      NS(I)=L1-1                                                        MAIN
      GO TO 4                                                           MAIN
 37   IE=-1                                                             MAIN
      RETURN                                                            MAIN
 10   FOUND=1.                                                          MAIN
      NS(I)=J-2                                                         MAIN
 4    CONTINUE                                                          MAIN
      IF(FOUND) 11,12,11                                                MAIN
 12   IF(XA(I)-X(L2)) 13,13,14                                          MAIN
 14   IF(NEXTR.NE.0)  GO TO 13                                          MAIN
      IE=1                                                              MAIN
      RETURN                                                            MAIN
 13   NS(I)=L2-1                                                        MAIN
 11   L1=L2+2                                                           MAIN
 3    CONTINUE                                                          MAIN
      KF=2**LF                                                          MAIN
      MW=-2                                                             MAIN
      DO 18 I=1,KF,2                                                    MAIN
      L1=0                                                              MAIN
      IZ=0                                                              MAIN
      MW=MW+2                                                           MAIN
      NPT=1                                                             MAIN
      DO 19 J=1,LF                                                      MAIN
      MM=2**(J-1)                                                       MAIN
      IF(AND(MM,MW) .EQ. 0)  GO TO 22                                   MAIN
      N=NS(J)+1                                                         MAIN
      GO TO 23                                                          MAIN
 22   N=NS(J)                                                           MAIN
 23   N=N-L1                                                            MAIN
      L1=L1+NA(J)                                                       MAIN
      IZ=NPT*(N-1)+IZ                                                   MAIN
 19   NPT=NPT*NA(J)                                                     MAIN
      WJ(I)=Z(IZ+1)                                                     MAIN
 18   WJ(I+1)=Z(IZ+2)                                                   MAIN
      DO 32 I=1,LF                                                      MAIN
      M = NS(I)                                                         MAIN
      KF=KF/2                                                           MAIN
      RATIO=(XA(I)-X(M))/(X(M+1)-X(M))                                  MAIN
      DO 32 J=1,KF                                                      MAIN
 32   WJ(J)=WJ(2*J-1)+(WJ(2*J)-WJ(2*J-1))*RATIO                         MAIN
      ZR=WJ(1)                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX2(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(128), XAA   )                                  MAIN
      EQUIVALENCE (XNSEG(129), XA0   )                                  MAIN
      EQUIVALENCE (XNSEG(130), XA1   )                                  MAIN
      EQUIVALENCE (XNSEG(131), XA2   )                                  MAIN
      EQUIVALENCE (XNSEG(132), XA3   )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(232), TCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(233), RCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 2     CLIMB CMAX SCHEDULE (FORWARD OR REVERSE)             MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C MINIMUM FUEL PATH ADDED JAN., 1970 BY G.F.Q.                          MAIN
                                                                        MAIN
      AMF = TZ(ITZ)                                                     MAIN
C     XAA=0.0 MINIMUM TIME PATH                                         MAIN
C     XAA=1.0 MINIMUM FUEL PATH                                         MAIN
      XAA = TZ(ITZ +3)                                                  MAIN
      ATZ = TZ(ITZ +4) -0.5                                             MAIN
      WTKEP=WT                                                          MAIN
      HF=TZ(ITZ+1)                                                      MAIN
      HOLD=H                                                            MAIN
      H=HF                                                              MAIN
      CALL ALTA                                                         MAIN
      H=HOLD                                                            MAIN
      CALL ALTA                                                         MAIN
      DDH=(HF-H)/XTT                                                    MAIN
      XQFP=2.1                                                          MAIN
      NXTT=XTT-1.0                                                      MAIN
      XB0=QLIM                                                          MAIN
      XB1=AMLIM                                                         MAIN
      TCMAX=0.0                                                         MAIN
      RCMAX=0.0                                                         MAIN
      XA2=0.0                                                           MAIN
      XA3=0.0                                                           MAIN
      IF(TZ(ITZ +6) .GT. 0.5)  GO TO 219                                MAIN
 206  CALLCMAX                                                          MAIN
      AMS=AM                                                            MAIN
      IF(ATZ*(AME-AMS).GE.0.0) GO TO 208                                MAIN
 207  XTT=5.0                                                           MAIN
      CALLXCEL                                                          MAIN
      RCMAX=DAC                                                         MAIN
      TCMAX=TAC                                                         MAIN
      DAC=0.0                                                           MAIN
      TAC=0.0                                                           MAIN
 208  DO209I=1,NXTT                                                     MAIN
      H0=H                                                              MAIN
      HE=H+DDH                                                          MAIN
      H=HE                                                              MAIN
      CALLCMAX                                                          MAIN
      AMS=AM                                                            MAIN
      H=H0                                                              MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      CALLCLIMB                                                         MAIN
      RCMAX=RCMAX+RXC                                                   MAIN
      TCMAX=TCMAX+TTC                                                   MAIN
      RXC=0.0                                                           MAIN
      IF(XNZZ +E10 +E11 .GT. 1.0)  GO TO 100                            MAIN
 209  TTC=0.0                                                           MAIN
      H0=H                                                              MAIN
      HE=H+DDH                                                          MAIN
      H=HE                                                              MAIN
      CALLCMAX                                                          MAIN
      IF(ATZ*(AME-AMF).GT.0.0) GO TO 210                                MAIN
 211  AME=AMF                                                           MAIN
 210  H=H0                                                              MAIN
      AMS=AM                                                            MAIN
      XTT=5.0                                                           MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      CALLCLIMB                                                         MAIN
      AMS=AM                                                            MAIN
      AME=AMF                                                           MAIN
      IF(ATZ*(AMS-AME).GT.0.0) CALL XCEL                                MAIN
 212  RCMAX=RCMAX+DAC+RXC                                               MAIN
      TCMAX=TCMAX+TAC+TTC                                               MAIN
      TTC=0.0                                                           MAIN
      TAC=0.0                                                           MAIN
      RXC=0.0                                                           MAIN
      DAC=0.0                                                           MAIN
      GOTO100                                                           MAIN
C     CMAX CLIMB IN REVERSE                                             MAIN
 219  CALLCMAX                                                          MAIN
      XTT=-5.0                                                          MAIN
      IF(ATZ*(AM -AME).GE.0.0) GO TO 215                                MAIN
 214  AMS=AME                                                           MAIN
      AME=AM                                                            MAIN
      CALLXCEL                                                          MAIN
      RCMAX=RCMAX-DAC                                                   MAIN
      TCMAX=TCMAX-TAC                                                   MAIN
      DAC=0.0                                                           MAIN
      TAC=0.0                                                           MAIN
 215  DO216I=1,NXTT                                                     MAIN
      HE=H                                                              MAIN
      H0=H+DDH                                                          MAIN
      H=H0                                                              MAIN
      CALLCMAX                                                          MAIN
      AMS=AME                                                           MAIN
      AME=AM                                                            MAIN
      H=HE                                                              MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      CALLCLIMB                                                         MAIN
      RCMAX=RCMAX-RXC                                                   MAIN
      TCMAX=TCMAX-TTC                                                   MAIN
      RXC=0.0                                                           MAIN
      IF(XNZZ +E10 +E11 .GT. 1.0)  GO TO 100                            MAIN
 216  TTC=0.0                                                           MAIN
      HE=H                                                              MAIN
      H=H+DDH                                                           MAIN
      CALLCMAX                                                          MAIN
      IF(ATZ*(AMF-AME).GT.0.0) GO TO 217                                MAIN
 218  AME=AMF                                                           MAIN
 217  AMS=AME                                                           MAIN
      AME=AM                                                            MAIN
      H0=H                                                              MAIN
      H=HE                                                              MAIN
      XA1=(AME-AMS)/(HE-H0)                                             MAIN
      XA0=AME-XA1*HE                                                    MAIN
      CALLCLIMB                                                         MAIN
      RCMAX=RCMAX-RXC                                                   MAIN
      TCMAX=TCMAX-TTC                                                   MAIN
      RXC=0.0                                                           MAIN
      TTC=0.0                                                           MAIN
      IF(ATZ*(AM -AMF).GE.0.0) GO TO 100                                MAIN
 220  AME=AM                                                            MAIN
      AMS=AMF                                                           MAIN
      CALLXCEL                                                          MAIN
      RCMAX=RCMAX-DAC                                                   MAIN
      TCMAX=TCMAX-TAC                                                   MAIN
      DAC=0.0                                                           MAIN
      TAC=0.0                                                           MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX3(TZ, RG, NSR)                                    MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL RG(1)                                                        MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(159), ZX5   )                                  MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(329), TEWT  )                                  MAIN
      EQUIVALENCE (XNSEG(330), TFWT  )                                  MAIN
      EQUIVALENCE (XNSEG(332), PAIRS )                                  MAIN
      EQUIVALENCE (XNSEG(579), IPTZXX)                                  MAIN
      EQUIVALENCE (XNSEG(580), KKK   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 3                                                          MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     MATCHING THE RANGES OF TWO DIFFERENT LEGS                         MAIN
C     TZ(ITZ)    = NO. OF FIRST SEG. IN LEG 1                           MAIN
C     TZ(ITZ +1) = NO. OF LAST  SEG. IN LEG 1                           MAIN
C     TZ(ITZ +2) = NO. OF FIRST SEG. IN LEG 2                           MAIN
C     TZ(ITZ +3) = NO. OF LAST  SEG. IN LEG 2                           MAIN
C     TZ(ITZ +4) = NO. OF SEG. IN WHICH THE RANGE CAN BE ADJUSTED       MAIN
      IF(KKK .GE. 1)  GO TO 33                                          MAIN
      NL1 = TZ(ITZ +1) -TZ(ITZ) +1.0                                    MAIN
      NL2 = TZ(ITZ +3) -TZ(ITZ +2) +1.0                                 MAIN
      IL1 = TZ(ITZ)*10.0 -8.9                                           MAIN
      IL2 = TZ(ITZ +2)*10.0 -8.9                                        MAIN
      ILA = TZ(ITZ +4)*10.0 -8.9                                        MAIN
      J=1                                                               MAIN
      K = TZ(ITZ +4) -0.9                                               MAIN
      TJTT=0.                                                           MAIN
      FJTT=0.                                                           MAIN
      RJTT=0.                                                           MAIN
C                                                                       MAIN
      DO 39 I=1,K                                                       MAIN
      TJTT=TJTT+RG(J+3)                                                 MAIN
      FJTT=FJTT+RG(J+4)                                                 MAIN
      RJTT=RJTT+RG(J+5)                                                 MAIN
      J=J+10                                                            MAIN
   39 CONTINUE                                                          MAIN
C                                                                       MAIN
      J=J-10                                                            MAIN
      WTJTT=RG(J)                                                       MAIN
      HJTT=RG(J+1)                                                      MAIN
      AMJTT=RG(J+2)                                                     MAIN
   33 CONTINUE                                                          MAIN
      RLEG1=0.0                                                         MAIN
      FLEG1=0.0                                                         MAIN
      FLEG2=0.0                                                         MAIN
      RLEG2=0.0                                                         MAIN
C                                                                       MAIN
      DO 31 K=1,NL1                                                     MAIN
      AR=-1.                                                            MAIN
      IF(RG(IL1-10).GT.RG(IL1))AR=1.                                    MAIN
      RLEG1=RLEG1+RG(IL1+5)*AR                                          MAIN
      FLEG1=FLEG1+RG(IL1-10)-RG(IL1)                                    MAIN
      IL1 = IL1 +10                                                     MAIN
   31 CONTINUE                                                          MAIN
C                                                                       MAIN
      IL1 = TZ(ITZ)*10.0 -8.9                                           MAIN
C                                                                       MAIN
      DO 32 K=1,NL2                                                     MAIN
      AR=-1.                                                            MAIN
      IF(RG(IL2-10).GT.RG(IL2))AR=1.                                    MAIN
      RLEG2=RLEG2+RG(IL2+5)*AR                                          MAIN
      FLEG2=FLEG2+RG(IL2-10)-RG(IL2)                                    MAIN
      IL2 = IL2 +10                                                     MAIN
   32 CONTINUE                                                          MAIN
C                                                                       MAIN
      IL2 = TZ(ITZ +2)*10.0 -8.9                                        MAIN
      IF(KKK .GT. 0)  GO TO 35                                          MAIN
 34   KK=ILA+4                                                          MAIN
      RK1=TZ(KK)                                                        MAIN
      DKK1=RLEG2-RLEG1                                                  MAIN
      TZ(KK)=RK1+DKK1*(1.0/(1.0+(RLEG2/RLEG1)*(FLEG1/FLEG2)))           MAIN
      KKK=KKK+1                                                         MAIN
      GO TO 38                                                          MAIN
C                                                                       MAIN
 35   RK2=TZ(KK)                                                        MAIN
      DKK2=RLEG2-RLEG1                                                  MAIN
      BBB=(DKK1-DKK2)/(RK1-RK2)                                         MAIN
      AAA=DKK1-BBB*RK1                                                  MAIN
      RK1=RK2                                                           MAIN
      DKK1=DKK2                                                         MAIN
      TZ(KK)=-AAA/BBB                                                   MAIN
      KKK=KKK+1                                                         MAIN
      NXTT=XTT                                                          MAIN
      IF(KKK .GT. NXTT)  GO TO 37                                       MAIN
      IF(ABS(DKK2) .GT. 1.0)  GO TO 38                                  MAIN
   37 CONTINUE                                                          MAIN
      KKK = 0                                                           MAIN
      NSR = 0                                                           MAIN
      RETURN                                                            MAIN
C     ------                                                            MAIN
   38 CONTINUE                                                          MAIN
      ITZ=ILA-10                                                        MAIN
      TEFWT = TEWT +TFWT                                                MAIN
      IF(TEFWT .GT. 0.0001)  ZX5 = PAIRS -AINT((WGTO -RG(1))/TEFWT)     MAIN
      ZX5=AMAX1(ZX5,0.0)                                                MAIN
      RANGE=RJTT                                                        MAIN
      TIME=TJTT                                                         MAIN
      FUEL=FJTT                                                         MAIN
      AM=AMJTT                                                          MAIN
      H=HJTT                                                            MAIN
      WT=WTJTT                                                          MAIN
      WTKEP=WT                                                          MAIN
      NSR = 1                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX5(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      NAME LIST /OPTNN5/ WT, TTR, RN, NNGR, TICRT, RGCRT, RANGE         MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 5     CRUISE CLIMB FOR GIVEN RANGE (CONST. CL)             MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      H0=H                                                              MAIN
      TTR=TZ(ITZ+4)                                                     MAIN
      PSET=0.0                                                          MAIN
      XQBD=5.0                                                          MAIN
      CALL CHECK                                                        MAIN
      XQFP=4.1+TZ(ITZ+2)                                                MAIN
      WTKEP=WT                                                          MAIN
      RN=TZ(ITZ+4)-RANGE*(1.0-TZ(ITZ+3))                                MAIN
      NNGR=TZ(ITZ+6)+1.1                                                MAIN
      GOTO(81,83,82,84),NNGR                                            MAIN
 83   TTR=-TTR                                                          MAIN
      RN=-RN                                                            MAIN
 81   RGCRT=1.0                                                         MAIN
      TICRT=1.0                                                         MAIN
      GO TO 87                                                          MAIN
 84   TTR=-TTR                                                          MAIN
      RN=-RN                                                            MAIN
 82   RGCRT=0.0                                                         MAIN
      TICRT=0.0                                                         MAIN
   87 CONTINUE                                                          MAIN
      WRITE(6, OPTNN5)                                                  MAIN
      CALL GOGO                                                         MAIN
      TTR=ABS(TTR)*TICRT                                                MAIN
      RN=ABS(RN)*RGCRT                                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX6(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 6     CONSTANT ALT. CRUISE TO END WT CONST. MACH           MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
 6    W1=WT                                                             MAIN
      WTKEP=WT                                                          MAIN
      W2=TZ(ITZ+2)                                                      MAIN
      PSET=0.0                                                          MAIN
      XQFP=TZ(ITZ+6)+2.1                                                MAIN
      CALL RUN                                                          MAIN
      RN=ABS(RN)                                                        MAIN
      TTR=ABS(TTR)                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX8(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 8     CONSTANT ALT. CRUISE FOR GIVEN TIME C MACH           MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      H0=H                                                              MAIN
      WTKEP=WT                                                          MAIN
      TTR=TZ(ITZ+3)                                                     MAIN
      PSET=0.0                                                          MAIN
      XQFP=2.1                                                          MAIN
C     TZ(ITZ+4)=1. - FLY AT CONSTANT CL   0. FLY AT CONSTANT MACH       MAIN
      IF(TZ(ITZ+4).GT.0.5) XQFP=3.2                                     MAIN
      NNGR=TZ(ITZ+6)+1.1                                                MAIN
      GOTO(81,83,82,84),NNGR                                            MAIN
 83   TTR=-TTR                                                          MAIN
      RN=-RN                                                            MAIN
 81   RGCRT=1.0                                                         MAIN
      TICRT=1.0                                                         MAIN
      GO TO 87                                                          MAIN
 84   TTR=-TTR                                                          MAIN
      RN=-RN                                                            MAIN
 82   RGCRT=0.0                                                         MAIN
      TICRT=0.0                                                         MAIN
   87 CONTINUE                                                          MAIN
      CALL GOGO                                                         MAIN
      TTR=ABS(TTR)*TICRT                                                MAIN
      RN=ABS(RN)*RGCRT                                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTXX9(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 34), FPOL  )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(125), W1    )                                  MAIN
      EQUIVALENCE (XNSEG(126), W2    )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(141), XQFP  )                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(334), RANGE1)                                  MAIN
      EQUIVALENCE (XNSEG(335), RANGE2)                                  MAIN
      EQUIVALENCE (XNSEG(336), RANGE3)                                  MAIN
      EQUIVALENCE (XNSEG(337), FUEL1 )                                  MAIN
      EQUIVALENCE (XNSEG(338), FUEL2 )                                  MAIN
      EQUIVALENCE (XNSEG(339), FUEL3 )                                  MAIN
      EQUIVALENCE (XNSEG(348), RETWGT)                                  MAIN
      EQUIVALENCE (XNSEG(578), IPRGSV)                                  MAIN
      EQUIVALENCE (XNSEG(579), IPTZXX)                                  MAIN
      EQUIVALENCE(XNSEG(79),CL)                                         MAIN
      EQUIVALENCE(XNSEG(97),PS)                                         MAIN
      EQUIVALENCE(XNSEG(94),H  )                                        MAIN
      EQUIVALENCE(XNSEG(127),XQSW)                                      MAIN
      EQUIVALENCE(XNSEG(176),ATMOS)                                     MAIN
      EQUIVALENCE(XNSEG(72),AM  )                                       MAIN
      EQUIVALENCE(XNSEG(92),FN)                                         MAIN
      EQUIVALENCE(XNSEG(85),DRT)                                        MAIN
      EQUIVALENCE(XNSEG(91),FFR)                                        MAIN
      EQUIVALENCE (XNSEG(109),QS)                                       MAIN
      EQUIVALENCE (XNSEG(81), CASEN)                                    MAIN
      EQUIVALENCE(ATMOS(1),ASPEED)                                      MAIN
      EQUIVALENCE(ATMOS(8),Q   )                                        MAIN
      REAL ATMOS(20)                                                    MAIN
      INTEGER PSET                                                      MAIN
      INTEGER CASEN                                                     MAIN
      INTEGER H10(10)                                                   MAIN
      DATA H10 /6HRANGE1, 6HRANGE2, 6HRANGE3, 5HFUEL1, 5HFUEL2,         MAIN
     1          5HFUEL3, 2HWT, 4HTIME, 5HRANGE, 6HFAVAIL/               MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 9 BUDDIE REFUEL OPTION                                     MAIN
C     RANGE     FUEL AVAILABLE(FROM TANKER)                             MAIN
C     RANGE1    FUEL1                                                   MAIN
C     RANGE2    FUEL2                                                   MAIN
C     RANGE3    FUEL3                                                   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      CALL XFIT2(RANGE1, RANGE2, RANGE3, FUEL1, FUEL2, FUEL3,           MAIN
     1         FAA, FBB, FCC, XATYM, YM, XRR, XR)                       MAIN
C                                                                       MAIN
C     TZ(ITZ) CONTAINS TRANSFER RATE (POUNDS/MIN)                       MAIN
      WDOT = TZ(ITZ)                                                    MAIN
      WTRF = TZ(ITZ +1)                                                 MAIN
      IF(WTRF .LE. 0.0)  WTRF = WGTO                                    MAIN
C     MAXIMUM RANGE TO REFUEL IS RMAX                                   MAIN
      RMAX = 1.0E36                                                     MAIN
      IF(TZ(ITZ+3) .GT. 0.0)  RMAX = TZ(ITZ+4)                          MAIN
      IF (RMAX.GT.20.0) GO TO 400                                       MAIN
C       FULL CAPABILITY OF OPTION REQUIRES TWO SEGMENTS                 MAIN
C      THE FIRST CALCULATES THE HEAVYWEIGHT FLIGHT CONDITIONS           MAIN
C        RMAX SHOULD BE SET TO THE MAXIMUM ALLOW REFUEL MACH NUMBER     MAIN
C      NOTE THIS IS NOT A GENERAL OPTION BUT IS SPECIFIC IN SIDE        MAIN
C      ON SECOND CALL SET RMAX BIGGER THAN 20 AND IT WILL DO REFUEL     MAIN
C        RMAX IS INPUT BY MAXIMUM RANGE TO REFUEL IN MACROFORTAN        MAIN
      HSTART=H                                                          MAIN
      DH=100.                                                           MAIN
      HSPEC=23500.                                                      MAIN
      H=HSPEC+DH                                                        MAIN
      PSET=1                                                            MAIN
      HHVY=13600.                                                       MAIN
      AMSTRT=AM                                                         MAIN
      WSTART=WT                                                         MAIN
      WTKEP=WT                                                          MAIN
 199  CONTINUE                                                          MAIN
      DO 200 I=1,100                                                    MAIN
      H=H-DH                                                            MAIN
      CALL ATMOSD                                                       MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WTRF/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      CALL ENDAT                                                        MAIN
      RCA=(FN-DRT)*AM*ASPEED/WTRF                                       MAIN
C     RCR=200.+71.*TANKERWT/DEN*SPAN**2*PI*VEL IN KNOTS                 MAIN
      RCR=3.333+(2.3327*AM*ASPEED/Q)                                    MAIN
      IF (H.LE.HHVY) GO TO 201                                          MAIN
      IF (RCA.LT.RCR) GO TO 200                                         MAIN
      FNHVY=FN                                                          MAIN
      AMHVY=AM                                                          MAIN
      HHVY=H                                                            MAIN
      FFHVY=FFR                                                         MAIN
      RCRHVY=RCR                                                        MAIN
      GO TO 201                                                         MAIN
 200  CONTINUE                                                          MAIN
 201  IF (H.GE.HSPEC) GO TO 202                                         MAIN
      AM=AM+.01                                                         MAIN
      H=H+600.                                                          MAIN
      IF (AM.LE.RMAX) GO TO 199                                         MAIN
 202  H=HHVY                                                            MAIN
      AM=AMHVY                                                          MAIN
      PSET=3                                                            MAIN
      CALL ATMOSD                                                       MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WTRF/QS                                                        MAIN
      CALL DRAG                                                         MAIN
      FNRQ=(RCRHVY*WTRF/(AM*ASPEED))+DRT                                MAIN
      PS=FNRQ/FNHVY                                                     MAIN
      CALL ENDAT                                                        MAIN
      FFHVY=FFR                                                         MAIN
C     THIS COMPLETES CALC OF THE HEAVYWEIGHT CONDITION                  MAIN
      AM=AMSTRT                                                         MAIN
      H=HSTART                                                          MAIN
      WTSA=WT                                                           MAIN
      TSA=TIME                                                          MAIN
      RSA=RANGE                                                         MAIN
      FSA = WTRF -WT                                                    MAIN
      FAVAIL = FAA +FBB*RANGE +FCC*RANGE**2                             MAIN
      IF(IPTZXX .EQ. 1  .OR.  IPRGSV .EQ. 1) WRITE(6, 10) H10,          MAIN
     1   RANGE1, RANGE2, RANGE3, FUEL1, FUEL2, FUEL3, WT, TIME, RANGE,  MAIN
     2   FAVAIL                                                         MAIN
   10 FORMAT(32H0 BUDDIE REFUEL   ...   OPTION 9/ 10X, 10(2X, A10)/ 10X,MAIN
     1       10G12.4)                                                   MAIN
      IF(FSA .GE. FAVAIL)  GO TO 99                                     MAIN
C                                                                       MAIN
      PSET=0                                                            MAIN
      CASEN=1                                                           MAIN
      XQBD=5.0                                                          MAIN
      CALL CHECK                                                        MAIN
C                                                                       MAIN
C     TYPE OF CRUISE IS SPECIFIED BY TZ(ITZ +6)                         MAIN
      XQFP=TZ(ITZ+6)+0.1                                                MAIN
      W1=WT                                                             MAIN
      WTRY=FUEL2                                                        MAIN
 301  W2=WTRF-WTRY                                                      MAIN
      W1=WSTART                                                         MAIN
      WT=WSTART                                                         MAIN
      AM=AMSTRT                                                         MAIN
      H=HSTART                                                          MAIN
      XQBD=5.0                                                          MAIN
      CALL CHECK                                                        MAIN
      CALL RUN                                                          MAIN
      FFTNS=(FFHVY+FFR)/2.                                              MAIN
      IF (WDOT.EQ.0.0) WDOT=1000000.                                    MAIN
      TTNS=(WTRF-W2)/(WDOT*60.)                                         MAIN
      DO 300 J=1,3                                                      MAIN
      FBTNS=TTNS*FFTNS                                                  MAIN
      FRQTNS=FBTNS+WTRF-W2                                              MAIN
      TTNS=FRQTNS/(WDOT*60.)                                            MAIN
 300  CONTINUE                                                          MAIN
      DLRN=AMHVY*ASPEED*TTNS*.5925                                      MAIN
      RSB=RSA+DLRN+RN                                                   MAIN
      IF (RSB.LE.RANGE2) FAVAIL=FUEL2+((RANGE2-RSB)*                    MAIN
     1(FUEL1-FUEL2)/(RANGE2-RANGE1))                                    MAIN
      IF (RSB.GT.RANGE2) FAVAIL=FUEL2-((RSB-RANGE2)*                    MAIN
     1(FUEL2-FUEL3)/(RANGE3-RANGE2))                                    MAIN
      WDIFF=FAVAIL-FRQTNS                                               MAIN
      WTRY=WTRY+(.7*WDIFF)                                              MAIN
      WDIF2=WDIFF*WDIFF                                                 MAIN
      IF (RSB.GE.RANGE3) GO TO 302                                      MAIN
      IF (WDIF2.GT.600.0) GO TO 301                                     MAIN
C      THIS COMPLETES CALC OF THE REFUEL PARAMETERS                     MAIN
 302  RETURN                                                            MAIN
 400  CONTINUE                                                          MAIN
C        PRINTS THE REFUEL RESULTS CALCULATED ON LST CALL               MAIN
      AM=AMHVY                                                          MAIN
      H=HHVY                                                            MAIN
      WT=WTRF                                                           MAIN
      WTKEP=WTRF+FBTNS                                                  MAIN
      RN=DLRN                                                           MAIN
      TTR=TTNS                                                          MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
   99 CONTINUE                                                          MAIN
C     TRANSFER FUEL   ...   FUEL USED .GE. FUEL AVAILABLE               MAIN
      FTRANS = FAVAIL                                                   MAIN
      WT = WT +FTRANS                                                   MAIN
      WTKEP=WT                                                          MAIN
C                                                                       MAIN
  100 CONTINUE                                                          MAIN
C     CHECK FOR INSTANTANEOUS FUEL TRANSFER                             MAIN
      IF(WDOT .LE. 0.0)  RETURN                                         MAIN
C     FUEL IS TO BE TRANSFERED AT THE RATE SPECIFIED BY WDOT            MAIN
C     WT IS VEHICLE WEIGHT AFTER FUEL TRANSFER                          MAIN
C     FTRANS IS FUEL TRANSFERED                                         MAIN
      W1 = WT -FTRANS                                                   MAIN
      W2 = WT                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX10(TZ, RG)                                         MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL RG(1)                                                        MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 10     LOCATING CALCULATED TZ VALUES                       MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
 10   N=TZ(ITZ+4)*10.0-8.9                                              MAIN
      ITT=TZ(ITZ+3)*10.0-8.9                                            MAIN
      IF(TZ(ITZ).GT.0.5) TZ(N)=RG(ITT+2)                                MAIN
      IF(TZ(ITZ+1).GT.0.5) TZ(N+1)=RG(ITT+1)                            MAIN
      IF(TZ(ITZ+2).GT.0.5) TZ(N+2)=RG(ITT)                              MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX11(TZ, RG)                                         MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL RG(1)                                                        MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 11     DETERMINE ALT. FOR CLC                              MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 11 NSEG LOGIC OPTION                                       MAIN
      NA=TZ(ITZ+4)*10.0-5.9-TZ(ITZ+3)                                   MAIN
      NB=TZ(ITZ+3)-0.9                                                  MAIN
      NB=ITZ+NB                                                         MAIN
      IF((RG(NA)-TZ(NB))*(TZ(ITZ+6)-0.5))113,113,112                    MAIN
C     DESIRED CONDITION RG ARRAY                                        MAIN
 112  NTZ=TZ(ITZ+4)*10.0-8.9                                            MAIN
      AM=RG(NTZ+2)                                                      MAIN
      H=RG(NTZ+1)                                                       MAIN
      WT=RG(NTZ)                                                        MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
C     DESIRED CONDITION TZ ARRAY                                        MAIN
 113  WT=TZ(ITZ+2)                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX12(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(236), ZX10  )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 12     NON-FUEL WEIGHT CHANGE                              MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
 12   WT=WT-TZ(ITZ+2)                                                   MAIN
      ZX10=ZX10-TZ(ITZ+2)                                               MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX15(TZ, RG, NSR)                                    MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL RG(1)                                                        MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      DATA IATZ/0/                                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 15                                                         MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      IATZ=IATZ+1                                                       MAIN
      WTKEP=WT                                                          MAIN
      IF(ABS(RANGE-TZ(ITZ+4))-.01)409,409,408                           MAIN
 408  GOTO(401,405,405,405,409),IATZ                                    MAIN
 401  ISTART=TZ(ITZ)*10.0-8.9                                           MAIN
      TSTT=0.0                                                          MAIN
      RSTT=0.0                                                          MAIN
      FSTT=0.0                                                          MAIN
      WSTT=RG(ISTART)                                                   MAIN
      HSTT=RG(ISTART+1)                                                 MAIN
      AMSTT=RG(ISTART+2)                                                MAIN
      K=TZ(ITZ)                                                         MAIN
      J=1                                                               MAIN
      DO403I=1,K                                                        MAIN
      TSTT=TSTT+RG(J+3)                                                 MAIN
      FSTT=FSTT+RG(J+4)                                                 MAIN
      RSTT=RSTT+RG(J+5)                                                 MAIN
 403  J=J+10                                                            MAIN
 402  RREQ=TZ(ITZ+4)                                                    MAIN
      ITZ=ISTART+10                                                     MAIN
      RC1=TZ(ITZ+4)                                                     MAIN
      TZ(ITZ+4)=AMAX1(0.0,TZ(ITZ+4)-(RANGE-RREQ)*0.9)                   MAIN
      RNG1=RANGE                                                        MAIN
      RC2=TZ(ITZ+4)                                                     MAIN
  407 RANGE=RSTT                                                        MAIN
 404  WT=WSTT                                                           MAIN
      H=HSTT                                                            MAIN
      AM=AMSTT                                                          MAIN
      FUEL=FSTT                                                         MAIN
      TIME=TSTT                                                         MAIN
      WTKEP=WT                                                          MAIN
      ITZ=ITZ-10                                                        MAIN
      NSR = 1                                                           MAIN
      RETURN                                                            MAIN
 405  RNG2=RANGE                                                        MAIN
      BBB=(RNG2-RNG1)/(RC2-RC1)                                         MAIN
      AAA=RNG2-BBB*RC2                                                  MAIN
      RNG1=RNG2                                                         MAIN
      RC1=RC2                                                           MAIN
      RC2=AMAX1(0.0,(RREQ-AAA)/BBB)                                     MAIN
      ITZ=ISTART+10                                                     MAIN
      TZ(ITZ+4)=RC2                                                     MAIN
      GOTO407                                                           MAIN
 409  IATZ=0                                                            MAIN
      NSR = 0                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX16(TZ, RG)                                         MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL RG(1)                                                        MAIN
      REAL TZ(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(233), RCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      EQUIVALENCE (XNSEG(652), IPATH )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 16     CLIMB OR ACCEL.   NO DESCENT - NO DECEL.            MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
      IPATH = 0                                                         MAIN
      INDMHP = 0                                                        MAIN
      ITT=TZ(ITZ+3)*10.0-8.9                                            MAIN
      JTT=TZ(ITZ+4)*10.0-8.9                                            MAIN
      WTKEP=WT                                                          MAIN
      AMA=RG(ITT+2)                                                     MAIN
      AMB=RG(JTT+2)                                                     MAIN
      HA=RG(ITT+1)                                                      MAIN
      HB=RG(JTT+1)                                                      MAIN
      IF(ABS(HB-HA).LT.1.0) GO TO 161                                   MAIN
      IF(HB-HA)162,161,163                                              MAIN
  161 CONTINUE                                                          MAIN
      IF(AMB .GT. AMA)  GO TO 163                                       MAIN
 162  H=HB                                                              MAIN
      AM=AMB                                                            MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
  163 CONTINUE                                                          MAIN
      IF(TZ(ITZ +6) .GT. 0.5)  GO TO 300                                MAIN
 164  TZ(ITZ)=AMB                                                       MAIN
      TZ(ITZ+1)=HB                                                      MAIN
      H=HA                                                              MAIN
      AM=AMA                                                            MAIN
      WT=RG(ITT)                                                        MAIN
      CALL OPTXX1(TZ)                                                   MAIN
  200 CONTINUE                                                          MAIN
      IF(TZ(ITZ+2) .GT. 0.0)  RETURN                                    MAIN
      RN = 0.0                                                          MAIN
      DAC = 0.0                                                         MAIN
      RXC = 0.0                                                         MAIN
      RCMAX = 0.0                                                       MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
  300 CONTINUE                                                          MAIN
      TZ(ITZ)=AMA                                                       MAIN
      TZ(ITZ+1)=HA                                                      MAIN
      H=HB                                                              MAIN
      AM=AMB                                                            MAIN
      WT=RG(JTT)                                                        MAIN
      CALL OPTXX1(TZ)                                                   MAIN
      GO TO 200                                                         MAIN
      END                                                               MAIN
      SUBROUTINE OPTX18(TZ)                                             MAIN
      REAL TZ(1)                                                        MAIN
C                                                                       MAIN
C     THIS OPTION DROPS ANY LEGITIMATE STORE COMBINATION                MAIN
C     FROM THE THREE STORE TYPE LOADS                                   MAIN
C     NO MORE THAN THE MAXIMUM CAN BE DROPPED.                          MAIN
C     PYLONS ARE ONLY DROPPED IF THEY SHOULD BE.                        MAIN
C                                                                       MAIN
      CALL STORES(3)                                                    MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX19(TZ)                                             MAIN
      REAL TZ(1)                                                        MAIN
C                                                                       MAIN
C     THIS OPTION DROPS ANY LEGITIMATE TANKS COMBINATION                MAIN
C     FROM THE THREE TANKS TYPE LOADS                                   MAIN
C     NO MORE THAN THE MAXIMUM CAN BE DROPPED.                          MAIN
C     PYLONS ARE ONLY DROPPED IF THEY SHOULD BE.                        MAIN
C     TANKS AND PYLONS MAY BE DROPPED AUTOMATICALLY IF DESIRED.         MAIN
C     THIS IS ACHIEVED BY AN INTERNAL NSEG CALL TO TANKS(3)             MAIN
C                                                                       MAIN
      CALL TANKS(3)                                                     MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX20(TZ)                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C     FUEL ALLOWANCE OPTION                                             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(151), XTT   )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      INTEGER PSET                                                      MAIN
      REAL TZ(1)                                                        MAIN
      WTKEP = WT                                                        MAIN
      RATIO = 0.0                                                       MAIN
      TIME = TZ(ITZ+3)/60.0                                             MAIN
      CALL ATMOSD                                                       MAIN
      K = TZ(ITZ +6)                                                    MAIN
      IF(K .EQ. 2)  GO TO 200                                           MAIN
      PS = TZ(ITZ+4)                                                    MAIN
      CALL ENDAT                                                        MAIN
      FUEL = FFR*TIME                                                   MAIN
      WT = WT -FUEL                                                     MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      PSET = 0                                                          MAIN
      RATIO = TZ(ITZ+4)                                                 MAIN
      DELT = TIME/XTT                                                   MAIN
      NXTT = XTT                                                        MAIN
      PS = WT*RATIO                                                     MAIN
      CALL ENDAT                                                        MAIN
      WF1 = FFR*DELT                                                    MAIN
      FUEL = 0.0                                                        MAIN
      DO 250 I=1,NXTT                                                   MAIN
      PS= (WT -WF1)*RATIO                                               MAIN
      CALL ENDAT                                                        MAIN
      WF2 = FFR*DELT                                                    MAIN
      WT = WT -(WF1 +WF2)/2.0                                           MAIN
      FUEL = FUEL +(WF1 +WF2)/2.0                                       MAIN
      WF1 = WF2                                                         MAIN
  250 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OVWGTE                                                 MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE OVERALL EMPTY WEIGHT                 MAIN
C     INCLUDING STORE, TANK, AND PYLON CONTRIBUTIONS.                   MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 71), BAREWT)                                  MAIN
      EQUIVALENCE (XNSEG( 46), IDRSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 47), IDRSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 48), IDRSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 64), IDRTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 65), IDRTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 66), IDRTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 67), IPLF1 )                                  MAIN
      EQUIVALENCE (XNSEG( 68), IPLF2 )                                  MAIN
      EQUIVALENCE (XNSEG( 69), IPLF3 )                                  MAIN
      EQUIVALENCE (XNSEG( 37), NSTOR1)                                  MAIN
      EQUIVALENCE (XNSEG( 38), NSTOR2)                                  MAIN
      EQUIVALENCE (XNSEG( 39), NSTOR3)                                  MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG( 35), OWE   )                                  MAIN
      EQUIVALENCE (XNSEG( 43), WGTSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 44), WGTSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 45), WGTSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 40), WGTS1 )                                  MAIN
      EQUIVALENCE (XNSEG( 41), WGTS2 )                                  MAIN
      EQUIVALENCE (XNSEG( 42), WGTS3 )                                  MAIN
      EQUIVALENCE (XNSEG( 61), WGTTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 62), WGTTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 63), WGTTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 55), WGTT1 )                                  MAIN
      EQUIVALENCE (XNSEG( 56), WGTT2 )                                  MAIN
      EQUIVALENCE (XNSEG( 57), WGTT3 )                                  MAIN
C                                                                       MAIN
      NTAPE6=6                                                          MAIN
      OWE=BAREWT                                                        MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      WRITE(NTAPE6,9001) BAREWT                                         MAIN
C                                                                       MAIN
C     STORES AND THEIR PYLONS                                           MAIN
C                                                                       MAIN
      IF(IDRSP1.EQ.2) GO TO 100                                         MAIN
      DUMM=    WGTSP1*FLOAT(NSTOR1)                                     MAIN
      I=1                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9002) I,WGTSP1,NSTOR1,DUMM                           MAIN
 100  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IDRSP2.EQ.2) GO TO 200                                         MAIN
      DUMM=    WGTSP2*FLOAT(NSTOR2)                                     MAIN
      I=2                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9002) I,WGTSP2,NSTOR2,DUMM                           MAIN
 200  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IDRSP3.EQ.2) GO TO 300                                         MAIN
      DUMM=    WGTSP3*FLOAT(NSTOR3)                                     MAIN
      I=3                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9002) I,WGTSP3,NSTOR3,DUMM                           MAIN
 300  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IDRSP1.NE.0) GO TO 400                                         MAIN
      DUMM=    (WGTS1       )*FLOAT(NSTOR1)                             MAIN
      I=1                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9003) I,WGTS1,WGTSP1,NSTOR1,DUMM                     MAIN
 400  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IDRSP2.NE.0) GO TO 500                                         MAIN
      DUMM=    (WGTS2       )*FLOAT(NSTOR2)                             MAIN
      I=2                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9003) I,WGTS2,WGTSP2,NSTOR2,DUMM                     MAIN
 500  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IDRSP3.NE.0) GO TO 600                                         MAIN
      DUMM=    (WGTS3       )*FLOAT(NSTOR3)                             MAIN
      I=3                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9003) I,WGTS3,WGTSP3,NSTOR3,DUMM                     MAIN
 600  CONTINUE                                                          MAIN
C                                                                       MAIN
C     TANKS AND PYLONS                                                  MAIN
C                                                                       MAIN
      IF(IPLF1.EQ.1) GO TO 700                                          MAIN
      IF(IDRTP1.EQ.2) GO TO 700                                         MAIN
      DUMM=    WGTTP1*FLOAT(NTANK1)                                     MAIN
      I=1                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9004) I,WGTTP1,NTANK1,DUMM                           MAIN
 700  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IPLF2.EQ.1) GO TO 800                                          MAIN
      IF(IDRTP2.EQ.2) GO TO 800                                         MAIN
      DUMM=    WGTTP2*FLOAT(NTANK2)                                     MAIN
      I=2                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9004) I,WGTTP2,NTANK2,DUMM                           MAIN
 800  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IPLF3.EQ.1) GO TO 900                                          MAIN
      IF(IDRTP3.EQ.2) GO TO 900                                         MAIN
      DUMM=    WGTTP3*FLOAT(NTANK3)                                     MAIN
      I=3                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9004) I,WGTTP3,NTANK3,DUMM                           MAIN
 900  CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IPLF1.EQ.1) GO TO 1000                                         MAIN
      IF(IDRTP1.NE.0) GO TO 1000                                        MAIN
      DUMM=    (WGTT1       )*FLOAT(NTANK1)                             MAIN
      I=1                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9005) I,WGTT1,WGTTP1,NTANK1,DUMM                     MAIN
 1000 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IPLF2.EQ.1) GO TO 1100                                         MAIN
      IF(IDRTP2.NE.0) GO TO 1100                                        MAIN
      DUMM=    (WGTT2       )*FLOAT(NTANK2)                             MAIN
      I=2                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9005) I,WGTT2,WGTTP2,NTANK2,DUMM                     MAIN
 1100 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(IPLF3.EQ.1) GO TO 1200                                         MAIN
      IF(IDRTP3.NE.0) GO TO 1200                                        MAIN
      DUMM=    (WGTT3       )*FLOAT(NTANK3)                             MAIN
      I=3                                                               MAIN
      OWE= OWE+DUMM                                                     MAIN
      WRITE(NTAPE6,9005) I,WGTT3,WGTTP3,NTANK3,DUMM                     MAIN
 1200 CONTINUE                                                          MAIN
C                                                                       MAIN
      WRITE(NTAPE6,9006) OWE                                            MAIN
C                                                                       MAIN
C     BEGIN FORMATS                                                     MAIN
C                                                                       MAIN
 9000 FORMAT(1H0,32H OVERALL WEIGHT EMPTY STATEMENT )                   MAIN
 9001 FORMAT(1H0,24H AIRCRAFT BARE WEIGHT = ,G12.5)                     MAIN
 9002 FORMAT(1H0,13H STORES TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER PYLON MAIN
     *PAIR .,I2,30H PAIRS. WEIGHT CONTRIBUTION = ,G12.5)                MAIN
 9003 FORMAT(1H0,13H STORES TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER STORE MAIN
     *PAIR. ,G12.5,24H POUNDS PER PYLON PAIR. ,I2,30H PAIRS. WEIGHT CONTMAIN
     *RIBUTION = ,G12.5)                                                MAIN
 9004 FORMAT(1H0,13H TANK S TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER PYLON MAIN
     *PAIR .,I2,30H PAIRS. WEIGHT CONTRIBUTION = ,G12.5)                MAIN
 9005 FORMAT(1H0,13H TANK S TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER TANK  MAIN
     *PAIR. ,G12.5,24H POUNDS PER PYLON PAIR. ,I2,30H PAIRS. WEIGHT CONTMAIN
     *RIBUTION = ,G12.5)                                                MAIN
 9006 FORMAT(1H0,24H OVERALL WEIGHT EMPTY = ,G12.5)                     MAIN
C                                                                       MAIN
C     END FORMATS                                                       MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  PACIT                                                  MAIN
          ENTRY  PACIT                                                  MAIN
 +        VFD    42/0HPACIT,18/4                                        MAIN
 PACIT    DATA   0           . RETURN EXIT                              MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SA2  A1+3                                                     MAIN
          SB4  X2                                                       MAIN
          SA1    B3          . J                                        MAIN
          SA2    B2          . J                                        MAIN
          IX1    X1-X2       . J-I                                      MAIN
          SB7    X1                                                     MAIN
          MX1    1           . SET SIGN BIT                             MAIN
          AX1    B7,X1       . FORM MASK OF J-I+1 BITS IN HEAD OF W     MAIN
          SB7    B7+1        . J-J+1 (=K) TO B7                         MAIN
          LX1    B7,X1       . SHIFT MASK TO TAIL OF X1                 MAIN
          SA2    B4          . B TO X2                                  MAIN
          BX2    X1*X2       . EXTRACT BITS FROM TAIL OF B TO X2        MAIN
          SA4    B3          . J                                        MAIN
          SB7    X4+1        . J+1                                      MAIN
          SA3    B1          . A                                        MAIN
          SA3    X3                                                     MAIN
          LX3    B7,X3       . SHIFT BITS TO BE CHANGED TO TAIL         MAIN
          BX1    -X1         . COMPLEMENT OF MASK TO X1                 MAIN
          BX4    X3*X1       . DELETE UNWANTED BITS                     MAIN
          IX2    X4+X2       . FORM NEW PACKED (BUT SHIFTED) WORD       MAIN
          SB5    60                                                     MAIN
          SB7    B5-B7       . 60-(J-I)                                 MAIN
          LX6    B7,X2       . SHIFT BACK PACKED WORD                   MAIN
          SA3    B1                                                     MAIN
          SA6    X3                                                     MAIN
          EQ     PACIT       . RETURN                                   MAIN
          END                                                           MAIN
      SUBROUTINE PAGHED                                                 MAIN
      COMMON /COMSEG/ XNSEG(600)                                        MAIN
      EQUIVALENCE (XNSEG(  4), TITLE )                                  MAIN
      EQUIVALENCE (XNSEG(490), DATE  )                                  MAIN
      EQUIVALENCE (XNSEG(491), NPAGE )                                  MAIN
      EQUIVALENCE (XNSEG(538), LONG  )                                  MAIN
      INTEGER TITLE(24)                                                 MAIN
      NPAGE=NPAGE+1                                                     MAIN
      LONG=0                                                            MAIN
      CLTIM=TIME(A)                                                     MAIN
      WRITE(6,900)DATE,CLTIM,NPAGE,TITLE                                MAIN
  900 FORMAT(1H1//14X,                                                  MAIN
     1       56H NSEG II --- AIRCRAFT PERFORMANCE PROGRAM               MAIN
     2       10X,A10,10X,A10,10X,5HPAGE I4/                             MAIN
     3       3(/30X, 8A10)//)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PAYLOD                                                 MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE VEHICLE PAYLOAD                      MAIN
C     INCLUDING STORE, TANK, AND PYLON CONTRIBUTIONS.                   MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG( 55), WGTT1 )                                  MAIN
      EQUIVALENCE (XNSEG( 56), WGTT2 )                                  MAIN
      EQUIVALENCE (XNSEG( 57), WGTT3 )                                  MAIN
      EQUIVALENCE (XNSEG( 66), IDRTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 65), IDRTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 64), IDRTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 69), IPLF3 )                                  MAIN
      EQUIVALENCE (XNSEG( 68), IPLF2 )                                  MAIN
      EQUIVALENCE (XNSEG( 67), IPLF1 )                                  MAIN
      EQUIVALENCE (XNSEG( 45), WGTSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 44), WGTSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 43), WGTSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 37), NSTOR1)                                  MAIN
      EQUIVALENCE (XNSEG( 38), NSTOR2)                                  MAIN
      EQUIVALENCE (XNSEG( 39), NSTOR3)                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG( 70), PLWINT)                                  MAIN
      EQUIVALENCE (XNSEG( 46), IDRSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 47), IDRSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 48), IDRSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 58), WGTFT1)                                  MAIN
      EQUIVALENCE (XNSEG( 59), WGTFT2)                                  MAIN
      EQUIVALENCE (XNSEG( 60), WGTFT3)                                  MAIN
      EQUIVALENCE (XNSEG( 40), WGTS1 )                                  MAIN
      EQUIVALENCE (XNSEG( 41), WGTS2 )                                  MAIN
      EQUIVALENCE (XNSEG( 42), WGTS3 )                                  MAIN
      EQUIVALENCE (XNSEG( 61), WGTTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 62), WGTTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 63), WGTTP3)                                  MAIN
C                                                                       MAIN
      NTAPE6=6                                                          MAIN
      PAYWT=PLWINT                                                      MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      WRITE(NTAPE6,9001) PLWINT                                         MAIN
C                                                                       MAIN
C     STORES AND THEIR PYLONS                                           MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP1.EQ.0) GO TO 100                                         MAIN
      DUMM=    WGTS 1*FLOAT(NSTOR1)                                     MAIN
      I=1                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 100  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9002) I,WGTS 1,NSTOR1,DUMM                           MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP2.EQ.0) GO TO 200                                         MAIN
      DUMM=    WGTS 2*FLOAT(NSTOR2)                                     MAIN
      I=2                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 200  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9002) I,WGTS 2,NSTOR2,DUMM                           MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP3.EQ.0) GO TO 300                                         MAIN
      DUMM=    WGTS 3*FLOAT(NSTOR3)                                     MAIN
      I=3                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 300  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9002) I,WGTS 3,NSTOR3,DUMM                           MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP1.NE.2) GO TO 400                                         MAIN
      DUMM=    (      WGTSP1)*FLOAT(NSTOR1)                             MAIN
      I=1                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 400  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9003) I,WGTS1,WGTSP1,NSTOR1,DUMM                     MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP2.NE.2) GO TO 500                                         MAIN
      DUMM=    (      WGTSP2)*FLOAT(NSTOR2)                             MAIN
      I=2                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 500  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9003) I,WGTS2,WGTSP2,NSTOR2,DUMM                     MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IDRSP3.NE.2) GO TO 600                                         MAIN
      DUMM=    (      WGTSP3)*FLOAT(NSTOR3)                             MAIN
      I=3                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 600  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9003) I,WGTS3,WGTSP3,NSTOR3,DUMM                     MAIN
C                                                                       MAIN
C     TANKS AND PYLONS                                                  MAIN
      DUMM = 0.0                                                        MAIN
C                                                                       MAIN
      IF(IPLF1.EQ.0) GO TO 700                                          MAIN
      IF(IDRTP1.EQ.0) GO TO 700                                         MAIN
      DUMM=    WGTT 1*FLOAT(NTANK1)                                     MAIN
      DUMM=DUMM+WGTFT1*FLOAT(NTANK1)                                    MAIN
      I=1                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 700  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9004) I,WGTT 1,NTANK1,DUMM,WGTFT1                    MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IPLF2.EQ.0) GO TO 800                                          MAIN
      IF(IDRTP2.EQ.0) GO TO 800                                         MAIN
      DUMM=    WGTT 2*FLOAT(NTANK2)                                     MAIN
      DUMM=DUMM+WGTFT2*FLOAT(NTANK2)                                    MAIN
      I=2                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 800  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9004) I,WGTT 2,NTANK2,DUMM,WGTFT2                    MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IPLF3.EQ.0) GO TO 900                                          MAIN
      IF(IDRTP3.EQ.0) GO TO 900                                         MAIN
      DUMM=    WGTT 3*FLOAT(NTANK3)                                     MAIN
      DUMM=DUMM+WGTFT3*FLOAT(NTANK3)                                    MAIN
      I=3                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 900  CONTINUE                                                          MAIN
      WRITE(NTAPE6,9004) I,WGTT 3,NTANK3,DUMM,WGTFT3                    MAIN
      DUMM = 0.0                                                        MAIN
C                                                                       MAIN
      IF(IPLF1.EQ.0) GO TO 1000                                         MAIN
      IF(IDRTP1.NE.2) GO TO 1000                                        MAIN
      DUMM=    (      WGTTP1)*FLOAT(NTANK1)                             MAIN
      DUMM=DUMM+WGTFT1*FLOAT(NTANK1)                                    MAIN
      I=1                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 1000 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9005) I,WGTT1,WGTTP1,NTANK1,DUMM,WGTFT1              MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IPLF2.EQ.0) GO TO 1100                                         MAIN
      IF(IDRTP2.NE.2) GO TO 1100                                        MAIN
      DUMM=    (      WGTTP2)*FLOAT(NTANK2)                             MAIN
      DUMM=DUMM+WGTFT2*FLOAT(NTANK2)                                    MAIN
      I=2                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 1100 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9005) I,WGTT2,WGTTP2,NTANK2,DUMM,WGTFT2              MAIN
C                                                                       MAIN
      DUMM = 0.0                                                        MAIN
      IF(IPLF3.EQ.0) GO TO 1200                                         MAIN
      IF(IDRTP3.NE.2) GO TO 1200                                        MAIN
      DUMM=    (      WGTTP3)*FLOAT(NTANK3)                             MAIN
      DUMM=DUMM+WGTFT3*FLOAT(NTANK3)                                    MAIN
      I=3                                                               MAIN
      PAYWT=PAYWT+DUMM                                                  MAIN
 1200 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9005) I,WGTT3,WGTTP3,NTANK3,DUMM,WGTFT3              MAIN
C                                                                       MAIN
      WRITE(NTAPE6,9006) PAYWT                                          MAIN
C                                                                       MAIN
C     BEGIN FORMATS                                                     MAIN
C                                                                       MAIN
 9000 FORMAT(1H0,32H PAYLOAD STATEMENT              )                   MAIN
 9001 FORMAT(1H0,36H INTERNAL AIRCRAFT PAYLOAD WEIGHT = ,G12.5)         MAIN
 9002 FORMAT(1H0,13H STORES TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER STORE MAIN
     *PAIR .,I2,30H PAIRS. WEIGHT CONTRIBUTION = ,G12.5)                MAIN
 9003 FORMAT(1H0,13H STORES TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER STORE MAIN
     *PAIR. ,G12.5,24H POUNDS PER PYLON PAIR. ,I2,30H PAIRS. WEIGHT CONTMAIN
     *RIBUTION = ,G12.5)                                                MAIN
 9004 FORMAT(1H0,13H TANK S TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER TANK  MAIN
     *PAIR .,I2,30H PAIRS. WEIGHT CONTRIBUTION = ,G12.5,/               MAIN
     *11H INCLUDING ,G12.5,30H POUNDS OF FUEL PER TANK PAIR )           MAIN
 9005 FORMAT(1H0,13H TANK S TYPE ,I1,5H ADD ,G12.5,24H POUNDS PER TANK  MAIN
     *PAIR. ,G12.5,24H POUNDS PER PYLON PAIR. ,I2,30H PAIRS. WEIGHT CONTMAIN
     *RIBUTION = ,G12.5,/                                               MAIN
     *11H INCLUDING ,G12.5,30H POUNDS OF FUEL PER TANK PAIR )           MAIN
 9006 FORMAT(1H0,36H    TOTAL AIRCRAFT PAYLOAD WEIGHT = ,G12.5)         MAIN
C                                                                       MAIN
C     END FORMATS                                                       MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PERPLT                                                 MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      COMMON /FLICOM/ SPACE(195)                                        MAIN
      EQUIVALENCE(SPACE( 1), AMLO)                                      MAIN
      EQUIVALENCE(SPACE(24), AMHI)                                      MAIN
      REAL AMHI(23), AMLO(23)                                           MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(202), DELAM )                                  MAIN
      EQUIVALENCE (XNSEG(204), AMF   )                                  MAIN
      EQUIVALENCE (XNSEG(205), DELH  )                                  MAIN
      EQUIVALENCE (XNSEG(206), NH    )                                  MAIN
      EQUIVALENCE (XNSEG(209), NAM   )                                  MAIN
      EQUIVALENCE (XNSEG(210), AMI   )                                  MAIN
      EQUIVALENCE (XNSEG(211), HI    )                                  MAIN
      EQUIVALENCE (XNSEG(637), NUMCON)                                  MAIN
      EQUIVALENCE (XNSEG(648), INDMAP)                                  MAIN
      EQUIVALENCE (XNSEG(650), HF    )                                  MAIN
      EQUIVALENCE (XNSEG(652), IPATH )                                  MAIN
      EQUIVALENCE (XNSEG(649), INDMHP)                                  MAIN
      IF(INDMAP .LE. 0)  RETURN                                         MAIN
      IF(INDMAP .GT. 12)  RETURN                                        MAIN
      ZMAX=-1.E36                                                       MAIN
      ZMIN=1.E36                                                        MAIN
      NX = NAM                                                          MAIN
      NY = NH                                                           MAIN
      NZ = NUMCON                                                       MAIN
      XLOW = AMI                                                        MAIN
      XHIGH = AMF                                                       MAIN
      YLOW = HI                                                         MAIN
      YHIGH = HF                                                        MAIN
      IF(XHIGH .GT. AMLIM) XHIGH = AMLIM                                MAIN
      DELAM = 0.0                                                       MAIN
      IF(NX .GT. 1)                                                     MAIN
     1DELAM = (XHIGH -XLOW)/(NX-1)                                      MAIN
      DELH = 0.0                                                        MAIN
      IF(NY .GT. 1)                                                     MAIN
     1DELH = (YHIGH -YLOW)/(NY-1)                                       MAIN
      H = YLOW -DELH                                                    MAIN
      GO TO (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), INDMAP             MAIN
    1 CONTINUE                                                          MAIN
      CALL MAP01                                                        MAIN
      GO TO 1000                                                        MAIN
    2 CONTINUE                                                          MAIN
      CALL MAP02                                                        MAIN
      GO TO 1000                                                        MAIN
    3 CONTINUE                                                          MAIN
      CALL MAP03                                                        MAIN
      GO TO 1000                                                        MAIN
    4 CONTINUE                                                          MAIN
      CALL MAP04                                                        MAIN
      GO TO 1000                                                        MAIN
    5 CONTINUE                                                          MAIN
      CALL MAP05                                                        MAIN
      GO TO 1000                                                        MAIN
    6 CONTINUE                                                          MAIN
      CALL MAP06                                                        MAIN
      GO TO 1000                                                        MAIN
    7 CONTINUE                                                          MAIN
      CALL MAP07                                                        MAIN
      GO TO 1000                                                        MAIN
    8 CONTINUE                                                          MAIN
      CALL MAP08                                                        MAIN
      GO TO 1000                                                        MAIN
    9 CONTINUE                                                          MAIN
      CALL MAP09                                                        MAIN
      GO TO 1000                                                        MAIN
   10 CONTINUE                                                          MAIN
      CALL MAP10                                                        MAIN
      GO TO 1000                                                        MAIN
   11 CONTINUE                                                          MAIN
      CALL MAP11                                                        MAIN
      GO TO 1000                                                        MAIN
   12 CONTINUE                                                          MAIN
      CALL MAP12                                                        MAIN
C                                                                       MAIN
 1000 CONTINUE                                                          MAIN
C                                                                       MAIN
      WRITE(6, 1001) IPATH, INDMHP                                      MAIN
 1001 FORMAT(32H0 INDICATORS FOR PATH GENERATION/ 10H0 IPATH = I2, 10X, MAIN
     1       10H INDMHP = I2)                                           MAIN
C     GENERATE CLIMB PATH IF REQUIRED                                   MAIN
      IF(IPATH .LT. 0)  GO TO 2000                                      MAIN
      WSAVE = WT                                                        MAIN
      IF(IPATH .GT. 0  .AND.  IPATH .NE. 1)  GO TO 1020                 MAIN
      CALL EDCLMB                                                       MAIN
      INTEQ = 1                                                         MAIN
      CALL MHPATH(INTEQ)                                                MAIN
 1020 CONTINUE                                                          MAIN
      WT = WSAVE                                                        MAIN
      IF(IPATH .GT. 0  .AND.  IPATH .NE. 2)  GO TO 1030                 MAIN
      CALL HDCLMB                                                       MAIN
      INTEQ = 2                                                         MAIN
      CALL MHPATH(INTEQ)                                                MAIN
 1030 CONTINUE                                                          MAIN
      WT = WSAVE                                                        MAIN
      IF(IPATH .GT. 0  .AND.  IPATH .NE. 3)  GO TO 1040                 MAIN
      CALL MDCLMB                                                       MAIN
      INTEQ = 3                                                         MAIN
      CALL MHPATH(INTEQ)                                                MAIN
 1040 CONTINUE                                                          MAIN
      WT = WSAVE                                                        MAIN
      IF(IPATH .GT. 0  .AND.  IPATH .NE. 4)  GO TO 1050                 MAIN
      CALL LNCLMB                                                       MAIN
      INTEQ = 4                                                         MAIN
      CALL MHPATH(INTEQ)                                                MAIN
 1050 CONTINUE                                                          MAIN
      WT = WSAVE                                                        MAIN
      IF(IPATH .GT. 0  .AND.  IPATH .NE. 5)  GO TO 1060                 MAIN
      CALL QCLIMB                                                       MAIN
      INTEQ = 5                                                         MAIN
      CALL MHPATH(INTEQ)                                                MAIN
 1060 CONTINUE                                                          MAIN
      WT = WSAVE                                                        MAIN
 2000 CONTINUE                                                          MAIN
C     END OF THIS PLOT FRAME   ...   ADVANCE PLOT SURFACE 17.0 INCHES   MAIN
      CALL PLOT(20.0, 0.0, -3)                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PHMACH(Z, NX, NY, NW)                                  MAIN
      REAL Z(1)                                                         MAIN
      L = NX +NY                                                        MAIN
      M = L +NW                                                         MAIN
      NL = 0                                                            MAIN
      DO 100 I=1,NW                                                     MAIN
      H = Z(L+I)                                                        MAIN
      WRITE(6, 1) H, (Z(J), J=1,NX)                                     MAIN
    1 FORMAT(18H0      ALTITUDE = F12.0/42X, 22H PERCENT OF MAX THRUST/ MAIN
     1       1X, 9H MACH NO., 12(1X, F9.1))                             MAIN
      DO 50 J=1,NY                                                      MAIN
      AM = Z(NX+J)                                                      MAIN
      WRITE(6, 2) AM, (Z(M+K), K=1,NX)                                  MAIN
    2 FORMAT(1X, F8.4, 12(1X, F9.3))                                    MAIN
      M = M +NX                                                         MAIN
   50 CONTINUE                                                          MAIN
      NL = NL +1                                                        MAIN
      IF(NL .LE. 3)  GO TO 100                                          MAIN
      CALL PAGHED                                                       MAIN
      NL = 0                                                            MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PICINX(INX)                                            MAIN
C                                                                       MAIN
      IF(INX .LE. 0)   RETURN                                           MAIN
      IF(INX .GT. 22)  RETURN                                           MAIN
      GO TO (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22), MAIN
     1                                                               INXMAIN
C                                                                       MAIN
    1 CONTINUE                                                          MAIN
      CALL INXX1                                                        MAIN
      RETURN                                                            MAIN
    2 CONTINUE                                                          MAIN
      CALL INXX2                                                        MAIN
      RETURN                                                            MAIN
    3 CONTINUE                                                          MAIN
      CALL INXX3                                                        MAIN
      RETURN                                                            MAIN
    4 CONTINUE                                                          MAIN
      CALL INXX4                                                        MAIN
      RETURN                                                            MAIN
    5 CONTINUE                                                          MAIN
      CALL INXX5                                                        MAIN
      RETURN                                                            MAIN
    6 CONTINUE                                                          MAIN
      CALL INXX6                                                        MAIN
      RETURN                                                            MAIN
    7 CONTINUE                                                          MAIN
      CALL INXX7                                                        MAIN
      RETURN                                                            MAIN
    8 CONTINUE                                                          MAIN
      CALL INXX8                                                        MAIN
      RETURN                                                            MAIN
    9 CONTINUE                                                          MAIN
      CALL INXX9                                                        MAIN
      RETURN                                                            MAIN
   10 CONTINUE                                                          MAIN
      CALL INX10                                                        MAIN
      RETURN                                                            MAIN
   11 CONTINUE                                                          MAIN
      CALL INX11                                                        MAIN
      RETURN                                                            MAIN
   12 CONTINUE                                                          MAIN
      CALL INX12                                                        MAIN
      RETURN                                                            MAIN
   13 CONTINUE                                                          MAIN
      CALL INX13                                                        MAIN
      RETURN                                                            MAIN
   14 CONTINUE                                                          MAIN
      CALL INX14                                                        MAIN
      RETURN                                                            MAIN
   15 CONTINUE                                                          MAIN
      CALL INX15                                                        MAIN
      RETURN                                                            MAIN
   16 CONTINUE                                                          MAIN
      CALL INX16                                                        MAIN
      RETURN                                                            MAIN
   17 CONTINUE                                                          MAIN
      CALL INX17                                                        MAIN
      RETURN                                                            MAIN
   18 CONTINUE                                                          MAIN
      CALL INX18                                                        MAIN
      RETURN                                                            MAIN
   19 CONTINUE                                                          MAIN
      CALL INX19                                                        MAIN
      RETURN                                                            MAIN
   20 CONTINUE                                                          MAIN
      CALL INX20                                                        MAIN
      RETURN                                                            MAIN
   21 CONTINUE                                                          MAIN
      CALL INX21                                                        MAIN
      RETURN                                                            MAIN
   22 CONTINUE                                                          MAIN
      CALL INX22                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PLWDRP(IENTRY)                                         MAIN
C     THIS SUBROUTINE IS USED TO DROP ANY PAYLOAD                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PNAMES                                                 MAIN
      COMMON /DICNAM/ LCOUNT, NAME(504), LOC(504)                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE (6,100) (NAME(I), LOC(I), I=1,LCOUNT)                       MAIN
  100 FORMAT (10(2X, A7, I4))                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  PUT                                                    MAIN
          ENTRY  PUT                                                    MAIN
 +        VFD 18/0HPUT,42/3                                             MAIN
 PUT      BSSZ 1                                                        MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SB4  B0-1        . INITIALIZE MULTIPLE OF 10 COUNTER.         MAIN
          SA2  B2          . PUT I IN X2.                               MAIN
 LOOP     SB4  B4+1        . COUNT MULTIPLES OF 10.                     MAIN
          SX2  X2-10       . SUBTRACT 10 FROM I.                        MAIN
          ZR   X2,OK       . IF X2 .LE. 0, EXIT FROM LOOP.              MAIN
          PL   X2,LOOP     . LOOP UNTIL NO MORE MULTIPLES OF 10 IN I.   MAIN
 OK       SA1  B1+B4       . LOAD WORD TO RECIEVE THE CHARACTER.        MAIN
          SA4  MASK1       .                                            MAIN
          SA5  SIX         .                                            MAIN
          SX2  X2-1        .                                            MAIN
          PX2  B0,X2       . PACK X2                                    MAIN
          DX2  X2*X5       . MULTIPLY BY SIX                            MAIN
          SA3  B3          . PUT T IN X3.                               MAIN
          SB2  X2          .                                            MAIN
          BX3  X3*X4       . MASK OUT LAST 9 CHAR. OF T.                MAIN
          AX3  B2,X3       . SHIFT CHARACTER INTO POSITION.             MAIN
          AX4  B2,X4       . SHIFT MASK INTO POSITION.                  MAIN
          BX6  -X4*X1      . MASK OUT CHARACTER IN S.                   MAIN
          BX6  X3+X6       . OR IN CHARACTER FROM T.                    MAIN
          SA6  B1+B4       . STORE IN PROPER POSITION IN STRING S.      MAIN
          EQ   B0,B0,PUT                                                MAIN
 MASK1    DATA 77000000000000000000B                                    MAIN
 SIX      DATA 20000000000000000006B                                    MAIN
          END                                                           MAIN
      SUBROUTINE QBOUND(XQ)                                             MAIN
      COMMON /CONCOM/                                                   MAIN
     1       NX, NY, NZ, XLOW, XHIGH, YLOW, YHIGH,                      MAIN
     2       ZMAX, ZMIN, ZCUTS(25),                                     MAIN
     3       XMESH(23), YMESH(23), ZMESH(21, 21)                        MAIN
      REAL XEND(4), YEND(4)                                             MAIN
      REAL XQ(1)                                                        MAIN
      XEND(3) = XMESH(NX+1)                                             MAIN
      XEND(4) = XMESH(NX+2)                                             MAIN
      YEND(3) = YMESH(NY+1)                                             MAIN
      YEND(4) = YMESH(NY+2)                                             MAIN
      XEND(1) = XQ(1)                                                   MAIN
      YEND(1) = YMESH(1)                                                MAIN
      DO 40 I=2,NY                                                      MAIN
      XEND(2) = XQ(I)                                                   MAIN
      YEND(2) = YMESH(I)                                                MAIN
      IF(XEND(1) .GT. XHIGH)  GO TO 20                                  MAIN
      IF(XEND(2) .GT. XHIGH)  GO TO 20                                  MAIN
      IF(XEND(1) .LT. XLOW )  GO TO 20                                  MAIN
      IF(XEND(2) .LT. XLOW )  GO TO 20                                  MAIN
      CALL LINE(XEND, YEND, 2, 1, 1, 5)                                 MAIN
   20 CONTINUE                                                          MAIN
      XEND(1) = XEND(2)                                                 MAIN
      YEND(1) = YEND(2)                                                 MAIN
   40 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QCLIMB                                                 MAIN
      COMMON /CMPATH/ KPATH, AMPATH(25), HPATH(25), CRANGE(25),         MAIN
     1                CTIME(25), CFUEL(25), CUMWT(25), PGAM7D(25),      MAIN
     2                PVEL(25), ENDPT(2)                                MAIN
      EQUIVALENCE (K, KPATH)                                            MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 77), AMS   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 95), HE    )                                  MAIN
      EQUIVALENCE (XNSEG( 96), H0    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ASPEED)                                  MAIN
      EQUIVALENCE (XNSEG(183), Q     )                                  MAIN
      EQUIVALENCE (XNSEG(184), QMSQR )                                  MAIN
      EQUIVALENCE (XNSEG(186), RHO   )                                  MAIN
      EQUIVALENCE (XNSEG(187), SPEED )                                  MAIN
      EQUIVALENCE (XNSEG(197), CLMAX )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(654), CLIMBQ)                                  MAIN
      CALL INIMHP                                                       MAIN
      NUMMH = 20                                                        MAIN
      IF(CLIMBQ .GT. 0.0)  GO TO 2                                      MAIN
      H = HE                                                            MAIN
      AM = AME                                                          MAIN
      CALL ATMOSD                                                       MAIN
      CLIMBQ = Q                                                        MAIN
    2 CONTINUE                                                          MAIN
      AM = AMS                                                          MAIN
      H = H0                                                            MAIN
      IF(CLIMBQ .GT. QLIM)  CLIMBQ = QLIM                               MAIN
      DELH = (HE -H0)/NUMMH                                             MAIN
C                                                                       MAIN
      K = 1                                                             MAIN
      DO 100 I=1,NUMMH                                                  MAIN
      HE = H0 +DELH                                                     MAIN
      H = HE                                                            MAIN
      CALL ATMOSD                                                       MAIN
      SPEED = SQRT(CLIMBQ*2.0/RHO)                                      MAIN
      AME = SPEED/ASPEED                                                MAIN
      AMSTAL  = SQRT(WT/(QMSQR*CLMAX*XQSW))                             MAIN
      IF(AME .LT. AMSTAL)  AME = AMSTAL                                 MAIN
      IF(AME .LT. AM)  AME = AM                                         MAIN
      CALL FLYMHP                                                       MAIN
      H0 = HE                                                           MAIN
      AMS = AME                                                         MAIN
  100 CONTINUE                                                          MAIN
C                                                                       MAIN
      AME = ENDPT(1)                                                    MAIN
      HE = ENDPT(2)                                                     MAIN
      ERROR = ABS(HE -H0) +ABS(AME -AMS)*1000.0                         MAIN
      IF(ERROR .GT. 2.0)  CALL FLYMHP                                   MAIN
  110 CONTINUE                                                          MAIN
      CALL MHPTAB(5)                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXABMA (X)                                             MAIN
      INTEGER UNPAC,GETIT                                               MAIN
   10 IZERO = GETIT(1,IZERO)                                            MAIN
      IF (IZERO.NE.0) GO TO 10                                          MAIN
      CALL PACIT(1,0,59,X)                                              MAIN
   20 IZERO = GETIT(1,IZERO)                                            MAIN
      IF (IZERO.NE.0) GO TO 20                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXABRT                                                 MAIN
      COMMON/QXABRT/JWRIT                                               MAIN
      COMMON/QXSYOZ/JOPEN,JOUT                                          MAIN
      COMMON/QXXEOF/IEOF                                                MAIN
      DIMENSION A(8)                                                    MAIN
      IF(JWRIT .EQ. 0)GO TO 10                                          MAIN
      BACKSPACE JOUT                                                    MAIN
  10  CALL QXABMA(3LABT)                                                MAIN
   11 I=2                                                               MAIN
      IF(I .NE. 1)GO TO 11                                              MAIN
      END                                                               MAIN
      SUBROUTINE QXDEN                                                  MAIN
      INTEGER QXCFND                                                    MAIN
      COMMON/QXSWCH/QXCFND,QXDUM(4)                                     MAIN
      QXCFND = 1                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXERR(NCAR,NOTE)                                       MAIN
      LOGICAL XX                                                        MAIN
      COMMON /QXOPTN/XX(28)                                             MAIN
      COMMON/QXBF/IBUF(2)                                               MAIN
      COMMON/QXMESS/LQC,LQX                                             MAIN
      COMMON/QXSCRH/L(133)                                              MAIN
      INTEGER BLANK                                                     MAIN
      COMMON/QXMACH/LWORD,IGLOBL                                        MAIN
      COMMON/QXSWCH/QXCFND,QXCTYP,QXCDG,QXCERR,QXCABT                   MAIN
      EQUIVALENCE (QXCERR,IERR)                                         MAIN
      EQUIVALENCE (QXCTYP,ITYPE)                                        MAIN
      DIMENSION NOTE(10)                                                MAIN
      DATA ITYPE/0/                                                     MAIN
      DATA BLANK/1H /                                                   MAIN
      IERR = IERR+1                                                     MAIN
      CALL QXFLW(NCAR,NOTE,2)                                           MAIN
      NW=(NCAR+LWORD-1)/LWORD                                           MAIN
      WRITE (6,1) (NOTE(I),I=1,NW)                                      MAIN
      WRITE(6,4)                                                        MAIN
C*    IF N OPTION ON FORCE PRINT OF ERROR LINE                          MAIN
      IF(.NOT. XX(7)) RETURN                                            MAIN
      DO 2 I=1,133                                                      MAIN
    2 L(I)=BLANK                                                        MAIN
      CALL STRMOV(IBUF(LQX),1,LQC,L,1,ER)                               MAIN
      NW=(LQC+9)/10                                                     MAIN
      WRITE (6,3)(L(I),I=1,NW)                                          MAIN
      WRITE(6,4)                                                        MAIN
    1 FORMAT(1H0,9X,15H**** ERROR ****,(6X,10A10)//)                    MAIN
    3 FORMAT(* PRECEDING DIAGNOSTIC REFERS TO THE FOLLOWING IMAGE( *,/(2MAIN
     1X,12A10))                                                         MAIN
    4 FORMAT(1H ,/)                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXFLW(LL,L,ITYPE)                                      MAIN
C      FOR TYPE = 1 .......                                             MAIN
C     BLANK FILL LAST WORD OF L AND WRITE TO TRANSFORMED FILE.          MAIN
C     USE FOR FORTRAN STATEMENTS  LT73 CHARS                            MAIN
C                                                                       MAIN
C     SIMPLY BLANK FILL LAST WORD FOR TYPE 2                            MAIN
C                                                                       MAIN
      COMMON/QXABRT/JWRIT                                               MAIN
      DIMENSION L(8),MASK(9)                                            MAIN
      COMMON/QXSYOZ/JOPEN,JOUT                                          MAIN
      DATA IBL/1H /                                                     MAIN
      DATA MASK(1) /77000000000000000000B/                              MAIN
      DATA MASK(2) /77770000000000000000B/                              MAIN
      DATA MASK(3) /77777700000000000000B/                              MAIN
      DATA MASK(4) /77777777000000000000B/                              MAIN
      DATA MASK(5) /77777777770000000000B/                              MAIN
      DATA MASK(6) /77777777777700000000B/                              MAIN
      DATA MASK(7) /77777777777777000000B/                              MAIN
      DATA MASK(8) /77777777777777770000B/                              MAIN
      DATA MASK(9) /77777777777777777700B/                              MAIN
      GO TO(1,2),ITYPE                                                  MAIN
    1 IF(JOPEN .NE. 1)GO TO 10                                          MAIN
    2 NW=(LL+9)/10                                                      MAIN
      J=MOD(LL,10)                                                      MAIN
      IF(J.EQ.0) GO TO 4                                                MAIN
      L(NW)= L(NW) .AND. MASK(J)                                        MAIN
      K=IBL .AND..NOT. MASK(J)                                          MAIN
      L(NW)= L(NW).OR.K                                                 MAIN
    4 IF(ITYPE.EQ.2) RETURN                                             MAIN
C     WRITE ON TRANSFORMED FILE                                         MAIN
    5 WRITE (JOUT,8000)(L(I),I=1,NW)                                    MAIN
      JWRIT=JWRIT+1                                                     MAIN
      RETURN                                                            MAIN
   10 CALL QXERR(78,78H  MAC SYSTEM ERROR. ATTEMPTED TO WRITE TRANSFORMEMAIN
     XD STATEMENT ON CLOSED FILE.  )                                    MAIN
      CALL QXABRT                                                       MAIN
      RETURN                                                            MAIN
 8000 FORMAT(8A10)                                                      MAIN
      END                                                               MAIN
      SUBROUTINE QXFSET(N)                                              MAIN
C  RESET INTERMEDIATE STRING POINTER                                    MAIN
C     SET LX=N-1                                                        MAIN
C         IF LX(NEW).GT.LX(OLD) FILL X WITH BLANKS                      MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      INTEGER ER                                                        MAIN
      DATA BLANK/10H          /                                         MAIN
      IF(N.GT.1326) GO TO 30                                            MAIN
      IF(N.GT.1)GO TO 10                                                MAIN
      LX=0                                                              MAIN
      RETURN                                                            MAIN
   10 J=N-1                                                             MAIN
      IF(LX.GT.J) GO TO 40                                              MAIN
      K=J-LX                                                            MAIN
      IF(K.LT.10) GO TO 15                                              MAIN
      IW=(LX+10)/10                                                     MAIN
      CALL STRMOV(BLANK,1,10*IW-LX,X,LX+1,ER)                           MAIN
      IW=IW+1                                                           MAIN
      IL=(J+9)/10                                                       MAIN
      DO 25 KK=IW,IL                                                    MAIN
      X(KK)=BLANK                                                       MAIN
   25 CONTINUE                                                          MAIN
      GO TO 40                                                          MAIN
   15 CALL STRMOV(BLANK,1,K,X,LX+1,ER)                                  MAIN
   40 LX=J                                                              MAIN
      RETURN                                                            MAIN
   30 CALL QXERR(59,59HSTRING COLUMN DESIGNATOR EXCEEDED 1326, MAX NO.  MAIN
     1CHARACTERS)                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXICOL(LA,LB,IND)                                      MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      COMMON /QXIC/LS,LF                                                MAIN
      COMMON /QXIR/LAA,LBB,L(650)                                       MAIN
      LS = LA                                                           MAIN
      LF = LB-1                                                         MAIN
      IF (LB.EQ.0) LF = LX                                              MAIN
      IF (LF.GT.LX) LF = LX                                             MAIN
      IF (IND.EQ.0) RETURN                                              MAIN
      LAA = 1                                                           MAIN
      LBB = 1                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXIDEN(N,S,K)                                          MAIN
      COMMON/QXPARS/PAR1,PAR2,PAR3,PAR4,PAR5                            MAIN
      INTEGER COMPLD,PAR3                                               MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      COMMON /QXIC/LS,LF                                                MAIN
      DIMENSION S(10)                                                   MAIN
      IF (LS+N-1-LF) 2, 2, 1                                            MAIN
    1 K=2                                                               MAIN
   11 RETURN                                                            MAIN
    2 KK=COMPLD (S,LF,N,X,LS)                                           MAIN
      IF (KK.EQ.1) GO TO 1                                              MAIN
      LS=PAR3                                                           MAIN
      K=1                                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXIFRC(N,S,K)                                          MAIN
      COMMON/QXPARS/PAR1,PAR2,PAR3,PAR4,PAR5                            MAIN
      INTEGER PATCOM,PAR1,PAR2                                          MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      COMMON /QXIC/LS,LF                                                MAIN
      COMMON /QXIR/LAA,LBB,L(650)                                       MAIN
      DIMENSION S(10)                                                   MAIN
      INTEGER PAR3                                                      MAIN
      IF(N.GT.0) GO TO 111                                              MAIN
      K=2                                                               MAIN
      RETURN                                                            MAIN
  111 CONTINUE                                                          MAIN
      IF(LS+N-1-LF) 2,2,1                                               MAIN
    1 K=2                                                               MAIN
   11 RETURN                                                            MAIN
    2 KK=PATCOM (S,LF,N,X,LS)                                           MAIN
      IF (KK.EQ.1) GO TO 1                                              MAIN
C  PAR1=ORIGINAL LS                                                     MAIN
      L(LAA)=PAR1                                                       MAIN
C  PAR2=LAST CHAR IN X BEFORE PATTERN                                   MAIN
      L(LAA+1)=PAR2                                                     MAIN
      LAA = LAA+2                                                       MAIN
C  PAR3=NEW LS, FIRST CHAR AFTER FOUND PATTERN                          MAIN
      LS=PAR3                                                           MAIN
      K=1                                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXIGET(LA,A,NDIM,NAME)                                 MAIN
      COMMON /QXBNAM/QXNAME                                             MAIN
      COMMON /QXIR/LAA,LBB,L(650)                                       MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      COMMON/QXMACH/LWORD,IGLOBL                                        MAIN
      INTEGER A,BLANK                                                   MAIN
      INTEGER ER                                                        MAIN
      DIMENSION A(10)                                                   MAIN
      DATA BLANK/1H /                                                   MAIN
      J = L(LBB+1)-L(LBB)                                               MAIN
      IF (J) 44, 10, 10                                                 MAIN
   44 CONTINUE                                                          MAIN
      LA = 0                                                            MAIN
      LBB=LBB+2                                                         MAIN
      RETURN                                                            MAIN
   10 IF((J+LWORD)/LWORD .LE. NDIM)GO TO 20                             MAIN
      NN=(J+LWORD-1)/LWORD                                              MAIN
      CALL QXERR(67,67H THE FOLLOWING INCOMPATABILITY WAS FOUND IN THE PMAIN
     XREVIOUS STATEMENT()                                               MAIN
      WRITE (6,1) NAME,MDIM,NN                                          MAIN
    1 FORMAT(25X,*STRING *,A7,* HAS DIMENSION=*,I3,* AND REQUIRES *,I3,/MAIN
     X/)                                                                MAIN
      RETURN                                                            MAIN
   20 LA = 0                                                            MAIN
      JA = L(LBB)                                                       MAIN
      JB = L(LBB+1)                                                     MAIN
      NW=(JB-JA+LWORD)/LWORD                                            MAIN
      A(NW) = BLANK                                                     MAIN
      LBB = LBB+2                                                       MAIN
      LA=JB-JA+1                                                        MAIN
      ER = 0                                                            MAIN
      INL = 1                                                           MAIN
      CALL STRMOV (X,JA,LA,A,INL,ER)                                    MAIN
      IF (ER.EQ.0) RETURN                                               MAIN
      WRITE(6, 29) NAME, JA, LA                                         MAIN
   29 FORMAT(45X, 1H/, A6, 5H/ JA=I3, 5X, 4H LA=I3)                     MAIN
      CALL QXERR (33,33H ERROR IN STRMOV CALL FROM QXIGET)              MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXIREC                                                 MAIN
      COMMON /QXIC/LS,LF                                                MAIN
      COMMON /QXIR/LAA,LBB,L(650)                                       MAIN
      L(LAA) = LS                                                       MAIN
      L(LAA+1) = LF                                                     MAIN
      LAA = LAA+2                                                       MAIN
      LS = LF+1                                                         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  QXSQZ                                                  MAIN
*                                                                       MAIN
*         ROUTINE TO ELIMINATE IMBEDDED BLANKS                          MAIN
*         TWO ENTRIES                                                   MAIN
*         CALL QXSQZY(LS,S,N)                                           MAIN
*           LS= LENGTH OF STRING (NO.OF CHARS)                          MAIN
*           S = STRING NAME                                             MAIN
*           N=NUMBER OF BLANKS ALLOWED IN ONE SEQUENCE                  MAIN
*         CALL QXSQZ(LS,S)                                              MAIN
*           ( SAME AS QXSQZY WITH N=0)                                  MAIN
*                                                                       MAIN
*              LS IS ADJUSTED FOR DELETED BLANKS  COMPRESSED S IS       MAIN
*              LEFT JUSTIFIED                                           MAIN
*         REGISTER USAGE  DURING COMPUTATION                            MAIN
*                                       X0=STORE ADDRESS                MAIN
*  B1=ADDRESS OF LS                     X1=CURRENT CHAR BEING TESTED    MAIN
*  B2=NO. BLANKS ALLOWED IN ONE SEQ.    X2=CURRENT WORD BEING TESTED    MAIN
*  B3=NO.CHARS TO BE TESTED             X3=CONSTANT(OCTAL 55)FOR BLANK  MAIN
*  B4=J,COUNT OF CHARS TESTED IN X2     X4=PICK-UP ADDRESS              MAIN
*  B5=K,COUNT OF CHARS MOVED INTO X7    X5=MASK,77 OCTAL                MAIN
*  B6=VARIABLE                          X6=NEW LENGTH VALUE             MAIN
*  B7=N(I),BLANKS IN SEQ. COUNTER       X7=WORD BEING BUILT FOR STORAGE MAIN
*                                                                       MAIN
          ENTRY QXSQZ                                                   MAIN
          VFD    30/5HQXSQZ,30/2                                        MAIN
 QXSQZ    PS                                                            MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SB3    ZERO              N=0 FOR QXSQZ                        MAIN
          SB6    -1               ENTRY INDICATOR                       MAIN
          EQ     B0,B0,Q1                                               MAIN
*                                                                       MAIN
          ENTRY QXSQZY                                                  MAIN
          VFD    36/6HQXSQZY,24/3                                       MAIN
 QXSQZY   PS                                                            MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SB6     0                                                     MAIN
 Q1       SX1    B0                INITIALIZE X1,X2,X3                  MAIN
          SA2    B2                S(1) INTO X2                         MAIN
          SX3    B0+45             BLANK                                MAIN
          SX0    B2                STORE ADDRESS                        MAIN
          SX4    B2                PICK-UP ADDRESS                      MAIN
          SA5    B3                                                     MAIN
          SB2    X5                N=NO.BLANKS TO ALLOW IN A SINGLE SEQ.MAIN
          SA5    B1                ORIGINAL LENGTH                      MAIN
          ZR     X5,Q3             EXIT IF LENGTH IS                    MAIN
          NG     X5,Q3             .LE.0                                MAIN
 Q2       SB3    X5                IN B3 FOR TESTING                    MAIN
          SX6    B3                AND X6 FOR NEW LS VALUE              MAIN
          SX5    B0+63             FORM MASK, OCTAL 77                  MAIN
          SX7    B0                                                     MAIN
          SB4    B0+10             J=NO.CHARS LEFT TO TEST IN X2        MAIN
          SB5    B0+10             K=NO.CHARS STILL TO BE PUT INTO X7   MAIN
          SB7    B0                N(I)=CURRENT BLANK SEQUENCE COUNT    MAIN
 LOOP     LX2    6                 LEFT CIRCULAR SHIFT HIGH ORDER CHAR  MAIN
          BX1    X2*X5             MASK OUT OTHER 9 CHARS               MAIN
          IX1    X1-X3             TEST FOR BLANK                       MAIN
          ZR     X1,STEP                                                MAIN
          SB7    B0                RESET N(I)                           MAIN
 RESTOR   IX1    X1+X3             RESTORE NON-BLANK OR WANTED BLANK    MAIN
          LX7    6                                                      MAIN
          BX7    X1+X7             AND MOVE INTO X7 FOR SUBSEQUENT STOREMAIN
          SB5    B5-1              K=K-1                                MAIN
          NE     B0,B5,STEP2                                            MAIN
          SA7    X0                STORE CURRENT WORD                   MAIN
          SX0    X0+1              INCREMENT STORE ADDRESS              MAIN
          SB5    B0+10             RESET K                              MAIN
          SX7    B0                                                     MAIN
          EQ     B0,B0,STEP2                                            MAIN
 STEP     LT     B7,B2,STEP3       N(I).LT.N, COUNT AND ALLOW BLANK     MAIN
          SX6    X6-1             REDUCE STRING LENGTH                  MAIN
 STEP2    SB3    B3-1                                                   MAIN
          EQ     B0,B3,EXIT        ALL DONE TESTING, CLEAN-UP AND EXIT  MAIN
          SB4    B4-1              J=J-1                                MAIN
          NE     B0,B4,LOOP                                             MAIN
          SX4    X4+1              INCREMENT PICK-UP ADDRESS            MAIN
          SA2    X4                PICK-UP NEXT WORD                    MAIN
          SB4    B0+10             RESET J                              MAIN
          EQ     B0,B0,LOOP                                             MAIN
 STEP3    SB7    B7+1              STEP N(I)                            MAIN
          EQ     B0,B0,RESTOR                                           MAIN
 EXIT     SB3    B0+10                                                  MAIN
          EQ     B3,B5,EXIT2                                            MAIN
          BX5    -X5               COMPLEMENT MASK                      MAIN
 EXL      LX7    6                 LEFT JUSTIFY                         MAIN
          BX7    X5*X7                                                  MAIN
          BX7    X3+X7             ADD TRAILING BLANK                   MAIN
          SB5    B5-1                                                   MAIN
          NE     B0,B5,EXL                                              MAIN
          SA7    X0                STORE FINAL WORD                     MAIN
 EXIT2    SA6    B1                STORE NEW LENGTH                     MAIN
 Q3       EQ     B0,B6,QXSQZY                                           MAIN
          EQ     B0,B0,QXSQZ                                            MAIN
 ZERO     DATA   0                                                      MAIN
          END                                                           MAIN
      SUBROUTINE QXSTXT (M,LS,S)                                        MAIN
      COMMON/QXMACH/LWORD,IGLOBL                                        MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      DIMENSION S(10)                                                   MAIN
      IF (M.NE.1) GO TO 20                                              MAIN
      IF (LS.GT.0) GO TO 5                                              MAIN
      LX = 0                                                            MAIN
      RETURN                                                            MAIN
    5 CONTINUE                                                          MAIN
      NW=(LS+LWORD-1)/LWORD                                             MAIN
      DO 10 I=1, NW                                                     MAIN
      X(I) = S(I)                                                       MAIN
   10 CONTINUE                                                          MAIN
      LX = LS                                                           MAIN
      RETURN                                                            MAIN
   20 CONTINUE                                                          MAIN
      LX = 0                                                            MAIN
      CALL QXFSET(M)                                                    MAIN
      CALL QXFTXT(LS,S)                                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RETRNW                                                 MAIN
C     THIS SUBROUTINE COMPUTES THE AIRCRAFT RETURN                      MAIN
C     WEIGHT INCLUDING ANY UNUSED FUEL RETURNED                         MAIN
C                                                                       MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG( 33), FF    )                                  MAIN
      EQUIVALENCE (XNSEG(225), FUELIN)                                  MAIN
      EQUIVALENCE (XNSEG(345),FUELT1 )                                  MAIN
      EQUIVALENCE (XNSEG(346),FUELT2 )                                  MAIN
      EQUIVALENCE (XNSEG(347),FUELT3 )                                  MAIN
      EQUIVALENCE (XNSEG( 35), OWE   )                                  MAIN
      EQUIVALENCE (XNSEG(348),RETWGT )                                  MAIN
C                                                                       MAIN
      RETWGT=OWE+FF*(FUELIN+FUELT1+FUELT2+FUELT3)                       MAIN
      WRITE(6, 9000)  RETWGT                                            MAIN
 9000 FORMAT(1H0,46H AIRCRAFT RETURN WEIGHT INCLUDING UNUSED FUEL ,     MAIN
     1       10X,10H RETWGT = ,G12.5)                                   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RFMAX                                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 97), PS    )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(112), RFAC  )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(121), VN    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(9),QMSQR),(ATMOS(16),VEL)                      MAIN
      LOGICAL IPXX(10)                                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES MACH NUMBER AND ALTITUDE COMBINATION FOR BEST MAIN
C                  RANGE FACTOR GIVEN WEIGHT, OR MACH NUMBER FOR BEST   MAIN
C                  RANGE FACTOR GIVEN ALTITUDE AND WEIGHT               MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      IF(IPXX(2))      WRITE(6,40)                                      MAIN
 40   FORMAT(86H0 RFMAX   WEIGHT ALTITUDE MACH   CL    DRAG  FN/FNMAX  SMAIN
     1FC  VEL(KT)  RFAC XNZZ E10 E11)                                   MAIN
      N=-1                                                              MAIN
      RHOLD=RC                                                          MAIN
      AM=XB1                                                            MAIN
      DAM=XB1/10.                                                       MAIN
 29   N=N+1                                                             MAIN
      Y1=0.                                                             MAIN
      Y2=0.                                                             MAIN
      X1=0.                                                             MAIN
      X2=0.                                                             MAIN
      DO 20 I = 1 , 11                                                  MAIN
      X3=X2                                                             MAIN
      X2=X1                                                             MAIN
      Y3=Y2                                                             MAIN
      Y2=Y1                                                             MAIN
      RC=RHOLD                                                          MAIN
      IF(XQBD.GT.0.5) GOTO33                                            MAIN
      CALLBERAN                                                         MAIN
      GOTO34                                                            MAIN
 33   QS=QMSQR*AM**2*XQSW                                               MAIN
      CALLCHECK                                                         MAIN
      VEL=VN                                                            MAIN
 34   X1=AM                                                             MAIN
      Y1=RFAC                                                           MAIN
      IF(IPXX(2))      WRITE(6,41) WT,H,AM,CL,DRT,PS,SFC,VEL,RFAC,XNZZ, MAIN
     1                             E10, E11                             MAIN
 41   FORMAT(1H ,7X,F8.0,F9.0,2F6.3,F7.0,F7.3,F8.3,F7.0,F8.0,3F4.1)     MAIN
      IF(E10  +XNZZ-1.5) 30,30,31                                       MAIN
 30   IF(Y1-Y2)21,20,20                                                 MAIN
 31   Y1=0.0                                                            MAIN
      XNZZ=1.0                                                          MAIN
      E10 = 0.0                                                         MAIN
 20   AM=AM-DAM                                                         MAIN
      AM=AM+DAM                                                         MAIN
      GOTO26                                                            MAIN
 21   IF(Y3)22,22,23                                                    MAIN
 22   AM=X2                                                             MAIN
      DAM=(X2-X1)/5.0                                                   MAIN
      IF(N)29,29,32                                                     MAIN
 32   AM=X2                                                             MAIN
      RFAC=Y2                                                           MAIN
      GO TO 25                                                          MAIN
 23   CALLXFIT2(X1,X2,X3,Y1,Y2,Y3,AA,BB,CC,XATYM,YM,XR,XRR)             MAIN
      AM=XATYM                                                          MAIN
      IF(N)24,24,25                                                     MAIN
 24   AM=(X3+AM)/2.                                                     MAIN
      DAM=.1*(X3-X1)                                                    MAIN
      GOTO29                                                            MAIN
 25   RC=RHOLD                                                          MAIN
      IF(XQBD.GT.0.5) GO TO 26                                          MAIN
      CALLBERAN                                                         MAIN
      IF(IPXX(2))      WRITE(6,41) WT,H,AM,CL,DRT,PS,SFC,VEL,RFAC,XNZZ, MAIN
     1                             E10, E11                             MAIN
   26 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RNSEG                                                  MAIN
      COMMON /COMSEG/ XNSEG(500)                                        MAIN
      COMMON /XQTMIS/ MISXQT                                            MAIN
      EQUIVALENCE (XNSEG(  1), XMLOD )                                  MAIN
      EQUIVALENCE (XNSEG(  2), XFLEN )                                  MAIN
      EQUIVALENCE (XNSEG(  3), XMSEG )                                  MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (INC   , RDATA( 82))                                  MAIN
      EQUIVALENCE (OP    , RDATA( 83))                                  MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      EQUIVALENCE (IN    , RDATA( 87))                                  MAIN
      EQUIVALENCE (NOLIST, RDATA( 90))                                  MAIN
      EQUIVALENCE (PAROPT, RDATA( 93))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (X     , RDATA( 95))                                  MAIN
      EQUIVALENCE (IX    , RDATA( 95))                                  MAIN
      LOGICAL MISXQT                                                    MAIN
      LOGICAL NOLIST                                                    MAIN
      REAL X(36)                                                        MAIN
      INTEGER IX(36)                                                    MAIN
      INTEGER BLANK                                                     MAIN
      INTEGER OP, SYMBOL                                                MAIN
      INTEGER STOP, STCASE, REWIND,      END,      DATA1, OLDSYM        MAIN
      INTEGER TABSIZ, GENPC, CHANGE                                     MAIN
      INTEGER RUN                                                       MAIN
      LOGICAL XMLOD, XFLEN, XMSEG, XCHNG                                MAIN
      DATA STOP /6HSTOP  /                                              MAIN
      DATA STCASE /6HSTCASE/                                            MAIN
      DATA REWIND /6HREWIND/                                            MAIN
      DATA END /3HEND/                                                  MAIN
      DATA BLANK /6H      /                                             MAIN
      DATA DATA1 /5HDATA1/                                              MAIN
      DATA TABSIZ /6HTABSIZ/                                            MAIN
      DATA MLOD /6HMLOD  /                                              MAIN
      DATA GENPC /6HGENPC /                                             MAIN
      DATA MSEG /6HMSEG  /                                              MAIN
      DATA CHANGE /6HCHANGE/                                            MAIN
      DATA RUN /6HRUN   /                                               MAIN
      DATA ICASE /2/                                                    MAIN
      OLDSYM = BLANK                                                    MAIN
      SYMBOL = 0                                                        MAIN
      NERROR = 0                                                        MAIN
      IN = 5                                                            MAIN
      XMLOD = .FALSE.                                                   MAIN
      XFLEN = .FALSE.                                                   MAIN
      XMSEG = .FALSE.                                                   MAIN
      XCHNG = .FALSE.                                                   MAIN
      CALL PAGHED                                                       MAIN
  100 CONTINUE                                                          MAIN
      CALL FETCH                                                        MAIN
      IF(SYMBOL .EQ. RUN)  RETURN                                       MAIN
      IF (SYMBOL .NE. STCASE) GO TO 200                                 MAIN
C     ...........                                                       MAIN
C     STCASE CARD                                                       MAIN
      IF(OP .EQ. TABSIZ)  GO TO 110                                     MAIN
      IF(OP .EQ. DATA1)   GO TO 120                                     MAIN
      IF(OP .EQ. MLOD)    GO TO 130                                     MAIN
      IF(OP .EQ. GENPC)   GO TO 140                                     MAIN
      IF(OP .EQ. MSEG)    GO TO 150                                     MAIN
      IF(OP .EQ. CHANGE)  GO TO 160                                     MAIN
      WRITE(6, 105)                                                     MAIN
  105 FORMAT(27H UNRECOGNIZABLE STCASE CARD)                            MAIN
      GO TO 900                                                         MAIN
  110 CONTINUE                                                          MAIN
      ICASE = 1                                                         MAIN
      GO TO 210                                                         MAIN
  120 CONTINUE                                                          MAIN
      ICASE = 2                                                         MAIN
C     SEGMENT INDEPENDENT DATA                                          MAIN
      GO TO 100                                                         MAIN
  130 CONTINUE                                                          MAIN
      ICASE = 3                                                         MAIN
      XMLOD = .TRUE.                                                    MAIN
      GO TO 100                                                         MAIN
  140 CONTINUE                                                          MAIN
      ICASE = 4                                                         MAIN
      XFLEN = .TRUE.                                                    MAIN
      GO TO 100                                                         MAIN
  150 CONTINUE                                                          MAIN
      ICASE = 5                                                         MAIN
      XMSEG = .TRUE.                                                    MAIN
      CALL INITZ                                                        MAIN
      MISXQT = .TRUE.                                                   MAIN
      GO TO 250                                                         MAIN
  160 CONTINUE                                                          MAIN
      ICASE = 6                                                         MAIN
      XCHNG = .TRUE.                                                    MAIN
      GO TO 100                                                         MAIN
C     ***   ***   ***   ***                                             MAIN
  200 CONTINUE                                                          MAIN
      IF(SYMBOL .EQ. OLDSYM)  GO TO 208                                 MAIN
      IF(SYMBOL .NE. END)  GO TO 202                                    MAIN
      OLDSYM = END                                                      MAIN
      IF(ICASE .EQ. 4)  CALL UNIT25(1, DUMEOF)                          MAIN
      IF(OP .EQ. REWIND)  CALL PAGHED                                   MAIN
      GO TO 100                                                         MAIN
  202 CONTINUE                                                          MAIN
      CALL DSERCH (SYMBOL,LOCV, INDX)                                   MAIN
      IF(LOCV .EQ. 0)  GO TO 900                                        MAIN
      IF(INDX .EQ. 0)  GO TO 900                                        MAIN
      IF(NERROR .GT. 0)  GO TO 100                                      MAIN
C     ***   ***   ***   ***   ***   ***                                 MAIN
  208 CONTINUE                                                          MAIN
      OLDSYM = SYMBOL                                                   MAIN
      GO TO (210, 220, 230, 240, 250, 260), ICASE                       MAIN
  210 CONTINUE                                                          MAIN
C     SET UP TABLE SIZE TO BE USED FOR THIS RUN                         MAIN
      CALL TABRE                                                        MAIN
C     TABLE SIZE NOW ESTABLISHED                                        MAIN
      OLDSYM = END                                                      MAIN
      GO TO 100                                                         MAIN
  220 CONTINUE                                                          MAIN
      LOCX = LOCV +INC -1                                               MAIN
      CALL STASH(LOCX, INDX)                                            MAIN
      GO TO 100                                                         MAIN
  230 CONTINUE                                                          MAIN
      GO TO 220                                                         MAIN
  240 CONTINUE                                                          MAIN
      GO TO 220                                                         MAIN
  250 CONTINUE                                                          MAIN
      CALL PAGHED                                                       MAIN
      CALL INXXX                                                        MAIN
      SYMBOL = END                                                      MAIN
      OLDSYM = END                                                      MAIN
      GO TO 100                                                         MAIN
  260 CONTINUE                                                          MAIN
      GO TO 100                                                         MAIN
C     ***   ***   ***   ***   ***   ***                                 MAIN
  900 CONTINUE                                                          MAIN
      NERROR = NERROR +1                                                MAIN
      GO TO 100                                                         MAIN
C     ***   ***   ***   ***   ***   ***                                 MAIN
      END                                                               MAIN
      SUBROUTINE SACNS1                                                 MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG(264), CD    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 80), CASE  )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(268), INDA40)                                  MAIN
      EQUIVALENCE (XNSEG(269), INDA41)                                  MAIN
      EQUIVALENCE (XNSEG(270), INDA42)                                  MAIN
      EQUIVALENCE (XNSEG(271), INDA43)                                  MAIN
      EQUIVALENCE (XNSEG(272), INDA44)                                  MAIN
      EQUIVALENCE (XNSEG(273), INDA45)                                  MAIN
      EQUIVALENCE (XNSEG(274), IA40X )                                  MAIN
      EQUIVALENCE (XNSEG(275), IA40Y )                                  MAIN
      EQUIVALENCE (XNSEG(276), IA41X )                                  MAIN
      EQUIVALENCE (XNSEG(277), IA41Y )                                  MAIN
      EQUIVALENCE (XNSEG(278), IA42X )                                  MAIN
      EQUIVALENCE (XNSEG(279), IA42Y )                                  MAIN
      EQUIVALENCE (XNSEG(280), IA43X )                                  MAIN
      EQUIVALENCE (XNSEG(281), IA43Y )                                  MAIN
      EQUIVALENCE (XNSEG(282), IA44X )                                  MAIN
      EQUIVALENCE (XNSEG(283), IA44Y )                                  MAIN
      EQUIVALENCE (XNSEG(284), IA45X )                                  MAIN
      EQUIVALENCE (XNSEG(285), IA45Y )                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      EQUIVALENCE (XNSEG(702),CASA)                                     MAIN
      EQUIVALENCE (XNSEG(706),IA43Z)                                    MAIN
      EQUIVALENCE (XNSEG(707),IA44Z)                                    MAIN
      EQUIVALENCE (XNSEG(708),IA45Z)                                    MAIN
      EQUIVALENCE (XNSEG(183),Q    )                                    MAIN
      EQUIVALENCE (XNSEG(701),ALPHAD)                                   MAIN
      EQUIVALENCE (XNSEG(709),CT   )                                    MAIN
      REAL CDA(3), KEY(3)                                               MAIN
      EQUIVALENCE (CDA(1), CD1)                                         MAIN
      EQUIVALENCE (CDA(2), CD2)                                         MAIN
      EQUIVALENCE (CDA(3), CD3)                                         MAIN
      INTEGER LOCSAC(50)                                                MAIN
      INTEGER CASE                                                      MAIN
C                                                                       MAIN
      CD1 = 0.0                                                         MAIN
      CD2 = 0.0                                                         MAIN
      CD3 = 0.0                                                         MAIN
      IF(CASE .EQ. 2)  GO TO 200                                        MAIN
      IF(CASE .EQ. 3) GO TO 300                                         MAIN
C                                                                       MAIN
 100  CONTINUE                                                          MAIN
      CD01=0.0                                                          MAIN
      DCDCL1 = 0.0                                                      MAIN
      IF(INDA40 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(22),IA40X,IA40Y,0    ,0,H,AM,0,0,CD01)         MAIN
      IF(INDA43 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(25),IA43X,IA43Y,0    ,0,CL,AM,0,0,DCDCL1)      MAIN
      CD1 = CD01 +DCDCL1                                                MAIN
      CD = CD1                                                          MAIN
      IF(CASE .EQ. 1)  GO TO 1002                                       MAIN
C                                                                       MAIN
 200  CONTINUE                                                          MAIN
      CD02=0.0                                                          MAIN
      DCDCL2 = 0.0                                                      MAIN
      IF(INDA41 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(23),IA41X,IA41Y,0    ,0,H,AM,0,0,CD02)         MAIN
      IF(INDA44 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(26),IA44X,IA44Y,0    ,0,CL,AM,0,0,DCDCL2)      MAIN
      CD2 = CD02 +DCDCL2                                                MAIN
      CD = CD2                                                          MAIN
      IF(CASE .EQ. 2)  GO TO 1002                                       MAIN
C                                                                       MAIN
 300  CONTINUE                                                          MAIN
      CD03=0.0                                                          MAIN
      DCDCL3 = 0.0                                                      MAIN
      IF(INDA42 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(24),IA42X,IA42Y,0    ,0,H,AM,0,0,CD03)         MAIN
      IF(INDA45 .NE. 0)                                                 MAIN
     1CALL HIHO(3,LOCSAC(27),IA45X,IA45Y,0    ,0,CL,AM,0,0,DCDCL3)      MAIN
      CD3 = CD03 +DCDCL3                                                MAIN
      CD = CD3                                                          MAIN
      IF(CASE .EQ. 3)  GO TO 1002                                       MAIN
      IF(CASE .LE. 0)  GO TO 1000                                       MAIN
C     (CASE .GT. 3)    ....    SUM DRAG COMPONENTS                      MAIN
      CD = CD1 +CD2 +CD3                                                MAIN
      GO TO 1002                                                        MAIN
C                                                                       MAIN
 1000 CONTINUE                                                          MAIN
C     (CASE .EQ. 0)   ...   PICK LEAST DRAG VALUE THAT IS GREATER THAN 0MAIN
      CALL SHELL(CDA, KEY, 3)                                           MAIN
      DO 1001 I=1,3                                                     MAIN
      CD = CDA(I)                                                       MAIN
      IF(CD.EQ.CD1) CASA=1.                                             MAIN
      IF(CD.EQ.CD2) CASA=2.                                             MAIN
      IF(CD.EQ.CD3) CASA=3.                                             MAIN
      IF(CD .GT. 0.0)  RETURN                                           MAIN
 1001 CONTINUE                                                          MAIN
C                                                                       MAIN
 1002 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SACSP                                                  MAIN
C                                                                       MAIN
C     THIS SUBROUTINE PROVIDES THE FOLLOWING PROGRAM NSEG AERODYNAMIC   MAIN
C     OPTIONS FOR STORES AND STORE PYLONS                               MAIN
C                                                                       MAIN
C         CDSP= CDS(MACH NUMBER)......UP TO THREE DISTINCT STORE PYLONS MAIN
C     NOTE THAT IF PYLONS ARE DISCARDED WITH STORE PYLON CAN BE         MAIN
C     INCLUDED WITH STORE                                               MAIN
C                                                                       MAIN
C     THIS ROUTINE SUPPLIES ADDITIVE DRAG TO EITHER AERO OPTION 8 OR9.  MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG(265), CDSTOR)                                  MAIN
      EQUIVALENCE (XNSEG(307), INDA01)                                  MAIN
      EQUIVALENCE (XNSEG(308), INDA02)                                  MAIN
      EQUIVALENCE (XNSEG(309), INDA03)                                  MAIN
      EQUIVALENCE (XNSEG(310), INDA04)                                  MAIN
      EQUIVALENCE (XNSEG(311), INDA05)                                  MAIN
      EQUIVALENCE (XNSEG(312), INDA06)                                  MAIN
      EQUIVALENCE (XNSEG(242), SPTYP1)                                  MAIN
      EQUIVALENCE (XNSEG(243), SPTYP2)                                  MAIN
      EQUIVALENCE (XNSEG(244), SPTYP3)                                  MAIN
      EQUIVALENCE (XNSEG(239), STYP1 )                                  MAIN
      EQUIVALENCE (XNSEG(240), STYP2 )                                  MAIN
      EQUIVALENCE (XNSEG(241), STYP3 )                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      INTEGER LOCSAC(50)                                                MAIN
C                                                                       MAIN
      CDS1=0.0                                                          MAIN
      CDS2=0.0                                                          MAIN
      CDS3=0.0                                                          MAIN
      CDSP1=0.0                                                         MAIN
      CDSP2=0.0                                                         MAIN
      CDSP3=0.0                                                         MAIN
C                                                                       MAIN
      IF (INDA01.NE.0)  CALL TLU  (AM,LOCSAC(1),CDS1)                   MAIN
      IF (INDA02.NE.0)  CALL TLU  (AM,LOCSAC(2),CDS2)                   MAIN
      IF (INDA03.NE.0)  CALL TLU  (AM,LOCSAC(3),CDS3)                   MAIN
      IF (INDA04.NE.0)  CALL TLU  (AM,LOCSAC(4),CDSP1)                  MAIN
      IF (INDA05.NE.0)  CALL TLU  (AM,LOCSAC(43),CDSP2)                 MAIN
      IF (INDA06.NE.0)  CALL TLU  (AM,LOCSAC(44),CDSP2)                 MAIN
C                                                                       MAIN
      CD1 = CDS1*STYP1+CDSP1*SPTYP1                                     MAIN
      CD2 = CDS2*STYP2+CDSP2*SPTYP2                                     MAIN
      CD3 = CDS3*STYP3+CDSP3*SPTYP3                                     MAIN
      CDSTOR = CD1+CD2+CD3                                              MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SACTP                                                  MAIN
C                                                                       MAIN
C     THIS SUBROUTINE PROVIDES THE FOLLOWING PROGRAM NSEG AERODYNAMIC   MAIN
C     OPTIONS FOR TANKS  AND TANK  PYLONS                               MAIN
C                                                                       MAIN
C         CDTP= CDT(MACH NUMBER)......UP TO THREE DISTINCT TANK  PYLONS MAIN
C     NOTE THAT IF PYLONS ARE DISCARDED WITH TANK  PYLON CAN BE         MAIN
C     INCLUDED WITH TANK                                                MAIN
C                                                                       MAIN
C     THIS ROUTINE SUPPLIES ADDITIVE DRAG TO EITHER AERO OPTION 8,9, OR MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG(266), CDTANK)                                  MAIN
      EQUIVALENCE (XNSEG(312), INDA06)                                  MAIN
      EQUIVALENCE (XNSEG(313), INDA07)                                  MAIN
      EQUIVALENCE (XNSEG(314), INDA08)                                  MAIN
      EQUIVALENCE (XNSEG(315), INDA09)                                  MAIN
      EQUIVALENCE (XNSEG(316), INDA10)                                  MAIN
      EQUIVALENCE (XNSEG(317), INDA11)                                  MAIN
      EQUIVALENCE (XNSEG(318), INDA12)                                  MAIN
      EQUIVALENCE (XNSEG(260), TPTYP1)                                  MAIN
      EQUIVALENCE (XNSEG(261), TPTYP2)                                  MAIN
      EQUIVALENCE (XNSEG(262), TPTYP3)                                  MAIN
      EQUIVALENCE (XNSEG(257), TTYP1 )                                  MAIN
      EQUIVALENCE (XNSEG(258), TTYP2 )                                  MAIN
      EQUIVALENCE (XNSEG(259), TTYP3 )                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      INTEGER LOCSAC(50)                                                MAIN
C                                                                       MAIN
      CDT1=0.0                                                          MAIN
      CDT2=0.0                                                          MAIN
      CDT3=0.0                                                          MAIN
      CDTP1=0.0                                                         MAIN
      CDTP2=0.0                                                         MAIN
      CDTP3=0.0                                                         MAIN
C                                                                       MAIN
      IF (INDA07.NE.0)  CALL TLU  (AM,LOCSAC(5),CDT1)                   MAIN
      IF (INDA08.NE.0)  CALL TLU  (AM,LOCSAC(45),CDT2)                  MAIN
      IF (INDA09.NE.0)  CALL TLU  (AM,LOCSAC(46),CDT3)                  MAIN
      IF (INDA10.NE.0)  CALL TLU  (AM,LOCSAC( 6),CDTP1)                 MAIN
      IF (INDA11.NE.0)  CALL TLU  (AM,LOCSAC( 7),CDTP2)                 MAIN
      IF (INDA12.NE.0)  CALL TLU  (AM,LOCSAC( 8),CDTP3)                 MAIN
C                                                                       MAIN
      CD1 = CDT1*TTYP1+CDTP1*TPTYP1                                     MAIN
      CD2 = CDT2*TTYP2+CDTP2*TPTYP2                                     MAIN
      CD3 = CDT3*TTYP3+CDTP3*TPTYP3                                     MAIN
      CDTANK = CD1+CD2+CD3                                              MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SEGOUT(TZ, RG, MRG)                                    MAIN
      COMMON /COMTAB/ TAB(3000)                                         MAIN
      COMMON /COMSEG/ XNSEG(700)                                        MAIN
      EQUIVALENCE (XNSEG( 99), PQ1   )                                  MAIN
      EQUIVALENCE (XNSEG(100), PQ2   )                                  MAIN
      EQUIVALENCE (XNSEG(101), PQ3   )                                  MAIN
      EQUIVALENCE (XNSEG(102), PQ4   )                                  MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE (XNSEG(539), IPSEG )                                  MAIN
      REAL OBSFUN(10), OBSLST(9)                                        MAIN
      EQUIVALENCE (OBSFUN, OBSLST)                                      MAIN
      INTEGER IPSEG(36)                                                 MAIN
      REAL TZ(1)                                                        MAIN
      INTEGER MRG(1)                                                    MAIN
      REAL RG(1)                                                        MAIN
      CALL DUMPRG(RG)                                                   MAIN
      CALL PAGHED                                                       MAIN
      LTZ = ITZ +9                                                      MAIN
      LMTZ = NUMSEG*10                                                  MAIN
      IF(LTZ .GT. LMTZ)  GO TO 5005                                     MAIN
C     ........                                                          MAIN
      WRITE (6,306)                                                     MAIN
 306  FORMAT(1H0,1X,6HWEIGHT,4X,8HALTITUDE,4X,4HMACH,                   MAIN
     14X,4HTIME,4X,4HFUEL,4X,5HRANGE,4X,4HXNZZ,4X,3HE10,                MAIN
     24X,3HE11,          4X,6HOPTION)                                   MAIN
      WRITE (6,305)(RG(I),I=1,LTZ)                                      MAIN
 305  FORMAT(1H ,F7.0,5X,F7.0,3X,F6.3,2X,F6.2,1X,F7.0,2X,F6.0,          MAIN
     14X,F3.1,5X,F3.1,4X,F3.1, 5X, I3)                                  MAIN
C     ........                                                          MAIN
 5005 CONTINUE                                                          MAIN
      TZ(13) = PAYWT                                                    MAIN
      WRITE(6, 5000) PAYWT                                              MAIN
 5000 FORMAT(1H0, 30X, 20HMISSION TIME HISTORY, 20X, 9HPAYLOAD =F8.0/   MAIN
     1 1H0, 30X,24H******INCREMENTAL*******,5X,9(1H*),5HTOTAL,10(1H*)/  MAIN
     230H   WEIGHT   MACH   ALTITUDE   ,2(24HRANGE   TIME(HRS)   FUEL,5XMAIN
     3),7H OPTION)                                                      MAIN
      PQ1=0.0                                                           MAIN
      PQ2=0.0                                                           MAIN
      PQ3=0.0                                                           MAIN
      PQ4=0.0                                                           MAIN
C                                                                       MAIN
      NOBSER = 10                                                       MAIN
      WRITE(15) NOBSER                                                  MAIN
      DO 5001 I=1,36                                                    MAIN
      IF(IPSEG(I) .LE. 0)  GO TO 5007                                   MAIN
      N = (IPSEG(I) -1)*10 +1                                           MAIN
      PQ1=PQ1+RG(N+5)                                                   MAIN
      PQ2=PQ2+RG(N+3)                                                   MAIN
      PQ3=PQ3+RG(N+4)                                                   MAIN
      K=N                                                               MAIN
      NOPT = MRG(N+9)                                                   MAIN
      IF(N .EQ. 1)  NOPT = RG(N+9) +0.1                                 MAIN
C     ...   ...                                                         MAIN
C     COMPENSATES FOR THE FACT THAT SOME SEGMENTS ARE FLOWN IN REVERSE  MAIN
      INREV = (NOPT-3)*(NOPT-10)*(NOPT-11)*(NOPT-13)*(NOPT-14)*(NOPT-15)MAIN
      REVTST = ABS(RG(N) -PQ4)                                          MAIN
      IF(INREV .NE. 0  .AND.  REVTST .LT. 0.5)  K = N-10                MAIN
C     ...   ...                                                         MAIN
      PQ4=RG(K)                                                         MAIN
      OBSFUN(1) = RG(K)                                                 MAIN
      OBSFUN(2) = RG(K+2)                                               MAIN
      OBSFUN(3) = RG(K+1)                                               MAIN
      OBSFUN(4) = RG(N+5)                                               MAIN
      OBSFUN(5) = RG(N+3)                                               MAIN
      OBSFUN(6) = RG(N+4)                                               MAIN
      OBSFUN(7) = PQ1                                                   MAIN
      OBSFUN(8) = PQ2                                                   MAIN
      OBSFUN(9) = PQ3                                                   MAIN
      OBSFUN(10) = NOPT                                                 MAIN
      WRITE(15) OBSFUN                                                  MAIN
      WRITE(6, 5002) OBSLST, NOPT                                       MAIN
 5002 FORMAT(1H0,F9.0,F7.3,F11.0,F8.2,F10.3,F9.0,F10.0,F10.2,F9.0,I7)   MAIN
 5001 CONTINUE                                                          MAIN
C                                                                       MAIN
 5007 CONTINUE                                                          MAIN
      END FILE 15                                                       MAIN
      RG(LMTZ+1)=PQ1                                                    MAIN
      RG(LMTZ+2)=PQ2                                                    MAIN
      RG(LMTZ+3)=PQ3                                                    MAIN
C                                                                       MAIN
      NRG = LMTZ +3                                                     MAIN
      REWIND 25                                                         MAIN
      WRITE(25) (TZ(I), I=1,LMTZ), (RG(I), I=1,NRG)                     MAIN
      REWIND 20                                                         MAIN
      READ(20) XNSEG, TAB                                               MAIN
      REWIND 25                                                         MAIN
      READ(25)  (TZ(I), I=1,LMTZ), (RG(I), I=1,NRG)                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SETYIC(Y)                                              MAIN
      REAL Y(5)                                                         MAIN
      COMMON /YICSET/       Y1(5), Y2(5), Y3(5)                         MAIN
      DO 10 I=1,5                                                       MAIN
      Y (I) = -1.0E10                                                   MAIN
      Y1(I) = -1.0E10                                                   MAIN
      Y2(I) = -1.0E10                                                   MAIN
      Y3(I) = -1.0E10                                                   MAIN
   10 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SHELL(IARRAY,KEY,N)                                    MAIN
C                                                                       MAIN
C     THIS IS A FORTRAN SUBROUTINE FOR SORTING AN INDEPENDENT ARRAY OF  MAIN
C SIZE N INTO ASCENDING ORDER (ALGEBRAICALLY LEAST FIRST), AND PROVIDINGMAIN
C A "KEY" ARRAY WHICH WILL ALLOW SUBROUTINE SHELLX TO RETURN DEPENDENT  MAIN
C ARRAYS TO THEIR ORIGINAL CORRESPONDENCE WITH THE INDEPENDENT ARRAY.   MAIN
C IARRAY IS THE NAME OF THE INDEPENDENT ARRAY (DIMENSIONED AT LEAST N INMAIN
C THE CALLING PROGRAM), KEY IS THE NAME OF THE KEY ARRAY (DIMENSIONED ATMAIN
C LEAST N IN THE CALLING PROGRAM), AND N IS THE NUMBER OF ELEMENTS IN   MAIN
C IARRAY AND KEY.                                                       MAIN
      DIMENSION IARRAY(1),KEY(1)                                        MAIN
      DO 10 I=1,N                                                       MAIN
   10 KEY(I)=I                                                          MAIN
      M=N                                                               MAIN
   20 M=M/2                                                             MAIN
      IF(M)30,30,40                                                     MAIN
   30 RETURN                                                            MAIN
   40 K=N-M                                                             MAIN
      DO 70 J=1,K                                                       MAIN
      I=J                                                               MAIN
   50 II=I+M                                                            MAIN
      IF(IARRAY(I)-IARRAY(II))70,70,60                                  MAIN
   60 LIMBO=IARRAY(I)                                                   MAIN
      IARRAY(I)=IARRAY(II)                                              MAIN
      IARRAY(II)=LIMBO                                                  MAIN
      LIMBO=KEY(I)                                                      MAIN
      KEY(I)=KEY(II)                                                    MAIN
      KEY(II)=LIMBO                                                     MAIN
      I=I-M                                                             MAIN
      IF(I)70,70,50                                                     MAIN
   70 CONTINUE                                                          MAIN
      GO TO 20                                                          MAIN
      END                                                               MAIN
      SUBROUTINE SHELLX(DARRAY,KEY,N)                                   MAIN
      DIMENSION DARRAY(1),KEY(1)                                        MAIN
      IFIRST=1                                                          MAIN
   10 DO 20 I=IFIRST,N                                                  MAIN
      IF(KEY(I))20,20,40                                                MAIN
   20 CONTINUE                                                          MAIN
      DO 30 I=1,N                                                       MAIN
   30 KEY(I)=-KEY(I)                                                    MAIN
      RETURN                                                            MAIN
   40 IFIRST=I                                                          MAIN
      TEMP=DARRAY(I)                                                    MAIN
      GO TO 60                                                          MAIN
   50 DARRAY(I)=DARRAY(IK)                                              MAIN
      I=IK                                                              MAIN
   60 IK=KEY(I)                                                         MAIN
      KEY(I)=-IK                                                        MAIN
      IF(IK-IFIRST)50,70,50                                             MAIN
   70 DARRAY(I)=TEMP                                                    MAIN
      GO TO 10                                                          MAIN
      END                                                               MAIN
      FUNCTION SL VALU (Z1, Z2, X1, X, X2)                              MAIN
      REAL Z1, Z2, X1, X, X2                                            MAIN
C                                                                       MAIN
      IF (X2 -X1) 100, 200, 100                                         MAIN
  100 CONTINUE                                                          MAIN
      SL VALU = Z1 +(Z2 -Z1)/(X2 -X1)*(X -X1)                           MAIN
      RETURN                                                            MAIN
  200 CONTINUE                                                          MAIN
      SL VALU = Z1                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE STASH(LOC, INDX)                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /COMTAB/ TAB(2000)                                         MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (X     , RDATA( 95))                                  MAIN
      REAL X(1)                                                         MAIN
      IF(NX .LE. 0)  RETURN                                             MAIN
      K = LOC -1                                                        MAIN
      IF(INDX .EQ. 2)  GO TO 20                                         MAIN
      DO 10 I=1,NX                                                      MAIN
      XNSEG(K +I) = X(I)                                                MAIN
   10 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
   20 CONTINUE                                                          MAIN
      DO 30 I=1,NX                                                      MAIN
      TAB(K +I) = X(I)                                                  MAIN
   30 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  STGCOM                                                 MAIN
*                                                                       MAIN
*         MODIFICATION OF KOMSTR FOR MAC PRE-COMPILER                   MAIN
*         THREE ENTRIES. ALL RETURN -2 IF INPUT C1,C2,CS,CF.LE.0      **MAIN
*        NEW OR MODIFIED CODING LINES HAVE ** AT RIGHT END OF COMMENT.  MAIN
*                                                                       MAIN
*           CALL STGCOM(S1,C1,N,S2,C2)                                  MAIN
*              N CHARS OF S1 STARTING AT C1 ARE COMPARED WITH N CHARS.  MAIN
*              FROM S2 STARTING AT C2.                                  MAIN
*                THE RETURNING VALUE OF STGCOM IS                       MAIN
*                   STGCOM=0  S1 .EQ.S2                                 MAIN
*                   =1 S1.NE.S2                                       **MAIN
*                                                                       MAIN
*           CALL PATCOM (S1,CF,N,S2,CS)                                 MAIN
*              THE PATTERN CONSISTING OF THE FIRST N CHARS OF STRING S1 MAIN
*              IS SEARCHED FOR BETWEEN CS(START) AND CF(FINAL) CHARS OF MAIN
*         S2. ALL LEADING NON-MATCHING CHARS AND IMBEDDED BLANKS ARE  **MAIN
*         IGNORED.                                                    **MAIN
*                THE RETURNED VALUE OF PATCOM IS                        MAIN
*                   PATCOM= 0 PATTERN FOUND                             MAIN
*                         = 1 NOT FOUND                                 MAIN
*            IF PATCOM=0 ON EXIT, THE FOLLOWING COMMUNICATION         **MAIN
*            PARAMETERS ARE SET                                       **MAIN
*              PAR1=LS VALUE AT ENTRY(EG.CS)                          **MAIN
*              PAR2=LAST CHAR POS SCANNED IN S2 BEFORE FIRST MATCHING **MAIN
*                   CHAR OF PATTERN                                   **MAIN
*              PAR3=LS(NEW VALUE=FIRST CHAR POS FOLLOWING PATTERN)    **MAIN
*                                                                     **MAIN
*                                                                       MAIN
*         CALL COMPLD(S1,CF,N,S2,CS)                                  **MAIN
*           SIMILAR TO PATCOM EXCEPT ONLY LEADING AND IMBEDDED BLANKS **MAIN
*           ARE IGNORED.                                              **MAIN
*             THE RETURNING VALUE OF COMPLD IS                        **MAIN
*               COMPLD=0 PATTERN FOUND                                **MAIN
*                    =1 NOT FOUND                                     **MAIN
*            IF COMPLD=0,PAR1,2,3 ARE SET AS FOR PATCOM               **MAIN
*                                                                     **MAIN
*                                                                     **MAIN
          USE    /QXPARS/                                             **MAIN
 PAR1     BSS    1                                                    **MAIN
 PAR2     BSS    1                                                    **MAIN
 PAR3     BSS    1                                                    **MAIN
 PAR4     BSS    1                                                    **MAIN
 PAR5     BSS    1                                                    **MAIN
          USE    *                                                    **MAIN
*                                                                     **MAIN
          ENTRY  STGCOM                                                 MAIN
 +        VFD    36/6HSTGCOM,24/5                                     **MAIN
 STGCOM   PS                                                          **MAIN
          SX7    B0                STGCOM FLAG VALUE=0                **MAIN
          EQ     B0,B0,INIT                                           **MAIN
*                                                                     **MAIN
          ENTRY  COMPLD                                               **MAIN
 +        VFD    36/6HCOMPLD,24/5                                     **MAIN
          ENTRY  COMPLD                                               **MAIN
 +        VFD    36/6HCOMPLD,24/5                                     **MAIN
 COMPLD   PS                                                          **MAIN
          SX7    B0+1              COMPLD FLAG VALUE=+1               **MAIN
          EQ     B0,B0,INIT                                           **MAIN
*                                                                     **MAIN
          ENTRY  PATCOM                                               **MAIN
 +        VFD    36/6HPATCOM,24/5                                     **MAIN
 PATCOM   PS                                                          **MAIN
          SX7    B0-1              PATCOM FLAG VALUE=-1               **MAIN
 INIT     SA7    FLAG              SAVE FLAG AND INPUT ARGUMENTS      **MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SA2  A1+3                                                     MAIN
          SB4  X2                                                       MAIN
          SA2  A1+4                                                     MAIN
          SB5  X2                                                       MAIN
          SA2  A1+4                                                     MAIN
          SB5  X2                                                       MAIN
          SX6    B1                                                   **MAIN
          SA6    ARG1                                                 **MAIN
          SX6    B2                                                   **MAIN
          SA6    ARG2                                                 **MAIN
          SX6    B3                                                   **MAIN
          SA6    ARG3                                                 **MAIN
          SX6    B4                                                   **MAIN
          SA6    ARG4                                                 **MAIN
          SX6    B5                                                   **MAIN
          SA6    ARG5                                                 **MAIN
          SA2    B5                                                   **MAIN
          SX6    X2                INITIAL LS VALUE=                  **MAIN
          SA6    PAR4              WORKING VARIABLE IN PATCOM         **MAIN
          NZ     X7,INIT2                                             **MAIN
          SA1    B3                                                   **MAIN
          SX0    X1                N2=N FOR STGCOM                    **MAIN
          EQ     B0,B0,BEGIN                                          **MAIN
 INIT2    SA1    B2                ADDITIONAL INITIALIZING FOR PATCOM **MAIN
          SA2    B5                AND COMPLD.                        **MAIN
          IX0    X1-X2             COMPUTE N2,SIZE OF SCAN FIELD IN S2**MAIN
          SX0    X0+1                                                 **MAIN
          SX6    X0                SAVE IN X0 AND                     **MAIN
          SA6    N2                N2 FOR FUTURE USE.                 **MAIN
          SB2    C1                SET B2 TO POINT TO 1,S1 FIRST CHAR **MAIN
          EQ     B0,B0,BEGIN                                          **MAIN
 BEGIN    SA1    B2                                                   **MAIN
          ZR     X1,ERROR                                               MAIN
          NG     X1,ERROR                                               MAIN
          SA1    B5                                                     MAIN
          ZR     X1,ERROR                                               MAIN
          NG     X1,ERROR                                               MAIN
          SA1    B3                                                     MAIN
          ZR     X1,L8                                                  MAIN
          PL     X1,OK                                                  MAIN
 ERROR    SX6    -2                                                     MAIN
          PL     X7,COMPLD                                            **MAIN
          NG     X7,PATCOM                                            **MAIN
          EQ     B0,B0,STGCOM                                           MAIN
*                                                                     **MAIN
 OK       SA1    B2                                                     MAIN
          SB2    B0+1                                                   MAIN
          SA4    TENO                                                   MAIN
          SX1    X1+9                                                   MAIN
          PX3    B0,X1                                                  MAIN
          NX3    B6,X3                                                  MAIN
          NX5    B6,X4                                                  MAIN
          FX3    X3/X5                                                  MAIN
          UX5    B6,X3                                                  MAIN
          LX3    B6,X5             K=INTEGRAL PART OF (C1+9)/10         MAIN
          SB1    B1-B2                                                **MAIN
          SB1    X3+B1             K+(START ADDRESS OF S1-1)            MAIN
          SX1    X1+B2                                                  MAIN
          PX3    B0,X3                                                  MAIN
          DX3    X4*X3                                                  MAIN
          UX6    B6,X3                                                  MAIN
          IX6    X1-X6             K1=(C1+10)-K*10 (1ST.S1 CHAR TO TEST)MAIN
          SA1    B5                                                     MAIN
          SX1    X1+9                                                   MAIN
          PX3    B0,X1                                                  MAIN
          NX3    B6,X3                                                  MAIN
          NX5    B6,X4                                                  MAIN
          FX3    X3/X5                                                  MAIN
          UX5    B6,X3                                                  MAIN
          LX3    B6,X5             J=INTEGRAL PART OF (C2+9)/10         MAIN
          SB4    B4-B2                                                  MAIN
          SB4    X3+B4             J+(START ADDRESS OF S2-1)            MAIN
          SX1    X1+B2                                                  MAIN
          PX3    B0,X3                                                  MAIN
          DX3    X4*X3                                                  MAIN
          UX7    B6,X3                                                  MAIN
          IX7    X1-X7             J1=(C2+10)-J*10 (1ST.S2 CHAR TO TEST)MAIN
          BX3    X6                                                     MAIN
          BX4    X7                                                     MAIN
          SA1    B1                MOVE S1(K) TO X1                     MAIN
          SA5    SIXO                                                   MAIN
          PX6    B0,X6                                                  MAIN
          DX6    X5*X6                                                  MAIN
          UX6    B6,X6                                                  MAIN
          SB6    X6                                                     MAIN
          LX1    B6,X1             LEFT SHIFT X1 K1 CHARACTERS          MAIN
          SA2    B4                MOVE S2(J) TO S2                   **MAIN
          PX7    B0,X7                                                  MAIN
          DX7    X5*X7                                                  MAIN
          UX7    B6,X7                                                  MAIN
          SB6    X7                                                     MAIN
          LX2    B6,X2             LEFT SHIFT X2 J1 CHARACTERS          MAIN
          BX6    X3                                                     MAIN
          SA5    B3                N1=NO.CHARS IN S1                  **MAIN
          SB2    X5                   STORED IN B2                    **MAIN
          SB6    B0+11                                                **MAIN
          SB3    X6                                                     MAIN
          SB5    X4                                                     MAIN
          SB3    B6-B3             K2=11-K1                           **MAIN
          SB5    B6-B5             J2=11-J1                           **MAIN
          SB7    X0                N2,EQ.N1 IN STGCOM,GE.IN PATCOM    **MAIN
          SX0    B0+45             SET X0 FOR BLANK CHAR TEST         **MAIN
          SA5    FLAG              PUT FLAG                           **MAIN
          SX7    X5                   VALUE INTO X7                   **MAIN
          SX3    B0                FOR N2(I) IN PATCOM                **MAIN
          SA5    TEMP                                                   MAIN
          SB6    B0+6              B6 USED FOR 1 CHAR SHIFT AND TEST  **MAIN
 LOOP     BX6    X2*X5             MASK OUT LEFT 9 CHARS OF X2        **MAIN
          BX4    X1*X5             SAME FOR X1                          MAIN
          IX4    X4-X6             CURRENT CHAR OF S2-CUR. CHAR OF S1   MAIN
          NZ     X4,L21            CONTINUE ON EQUAL                  **MAIN
          NZ     X3,L3                                                **MAIN
          SX3    B7                FIRST CHAR MATCH, SAVE N2(I)       **MAIN
 L3       SB2    B2-1              N1=N1-1                            **MAIN
          EQ     B2,B0,L8          IF N1.EQ.0 ALL CHAR.TESTED. MATCH. **MAIN
          SB3    B3-1              K2=K2-1                            **MAIN
          NE     B3,B0,L1R         IF(K.EQ.0) REFILL X1 FROM S1       **MAIN
          SB1    B1+1              K=K+1 WORD INDEX FOR S1            **MAIN
          SA1    B1                MOVE S1(K) TO X1                     MAIN
          SB3    B0+10             K2=10                              **MAIN
 L1R      SB7    B7-1              N2-1                               **MAIN
          LT     B7,B2,PFAIL                                          **MAIN
*                                  SCAN.IF B7.LT.B2,TOO FEW CHAR IN S2**MAIN
 L5       SB5    B5-1              J2=J2-1                              MAIN
          NE     B5,B0,L7          IF(J2.EQ.0) REFILL X2 FROM S2        MAIN
          SB4    B4+1              J=J+1  WORD INDEX FOR S2           **MAIN
          SA2    B4                MOVE S2(J) TO X2                     MAIN
          SB5    B0+10             J2=10                                MAIN
 L7       EQ     B0,B6,L71                                            **MAIN
          LX1    B6,X1             SHIFT CURRENT S1 WORD LEFT 1 CHAR  **MAIN
 L72      LX2    B6,X2             DITTO S2                           **MAIN
          EQ     B0,B0,LOOP        LOOP BACK FOR NEXT CHARACTER TEST  **MAIN
 L71      SB6    B0+6              RESET B6                           **MAIN
          EQ     B0,B0,L72                                            **MAIN
 L2       NZ     X7,PFAIL          IF FLAG NZ, USE PATCOM EXIT        **MAIN
 L22      PL     X4,L1                                                **MAIN
          SX6    B0-1              S1.LT.S2                           **MAIN
          EQ     B0,B0,STGCOM      RETURN                             **MAIN
 L1       SX6    B0+1              S1.GT.S2                           **MAIN
          EQ     B0,B0,STGCOM      RETURN                               MAIN
 L8       SX6    B0                S1=S2, OR PATTERN MATCH            **MAIN
          NZ     X7,PMATCH                                            **MAIN
          EQ     B0,B0,STGCOM      RETURN                             **MAIN
*                                                                       MAIN
 L21      ZR     X7,L22            IF FLAG IS 0,GO TO L2 EXIT.        **MAIN
          SB6    B0                                                   **MAIN
          IX6    X6-X0             TEST X6 FOR BLANK                  **MAIN
          ZR     X6,L1R            BLANK,CONTINUE                     **MAIN
          PL     X7,PFAIL          TO COMPLD FAIL EXIT                **MAIN
          ZR     X3,L1R            LEADING NON-BLANK,OK IN PATCOM.CONT**MAIN
          SB6    X3-1              N2(I)-1                            **MAIN
          SB6    B6-B7             TEST AGAINST CURRENT N2.           **MAIN
          EQ     B0,B6,L21A        SPECIAL CASE,1 CHAR PREV MATCH     **MAIN
          SA1    ARG2              RESET ENTRY ARGS FOR RESTART       **MAIN
          SA1    X1                CF IN X1                           **MAIN
          IX3    X1-X3             CF-N2(I)                           **MAIN
          SX6    X3+2              NEW VALUE OF CS                    **MAIN
          SA6    PAR4              SAVE FOR RESTART                   **MAIN
          SB5    PAR4              AS NEW ARG. OTHER ARGS UNCHANGED    *MAIN
          SA1    ARG1                                                 **MAIN
          SB1    X1                RESET S1                           **MAIN
          SA3    ARG3                                                 **MAIN
          SB3    X3                RESET N                            **MAIN
          SA4    ARG4                                                 **MAIN
          SB4    X4                RESET S2                           **MAIN
          SA2    ARG2                                                 **MAIN
          SB2    X2                RESET CF                           **MAIN
          EQ     B0,B0,INIT2       RESTART                            **MAIN
 L21A     SB2    B2+1              SPECIAL CASE--RESET N1             **MAIN
          SA1    B1                S1(1) INTO X1                      **MAIN
          SB3    B0+10             K2=10                              **MAIN
          SX3    B0                N2(I)                              **MAIN
          SB6    B0+6              RESET SHIFT                        **MAIN
          LX1    B6,X1             SHIFT S1(1) 1 CHAR                 **MAIN
          EQ     B0,B0,LOOP        CONTINUE                           **MAIN
 PFAIL    SX6    B0+1              NO PATTERN MATCH                   **MAIN
          PL     X7,COMPLD                                            **MAIN
          EQ     B0,B0,PATCOM                                         **MAIN
 PMATCH   SA1    ARG5              ORIGINAL LS INTO X1                **MAIN
          SA1    X1                                                   **MAIN
          SX6    X1                THEN TO X1                         **MAIN
          SA6    PAR1              STORE                              **MAIN
       SA1       PAR4              CURRENT LS VALUE IN X1             **MAIN
          SA2    N2                N2 INTO X2                         **MAIN
          IX1    X1+X2             LS+N2 IN X1                        **MAIN
          IX6    X1-X3                                                **MAIN
          SX6    X6-1              LAST CHAR POS IN S2 BEFORE PATTERN **MAIN
          SA6    PAR2                                                 **MAIN
          SB7    B0-B7                                                **MAIN
          SX6    X1+B7                                                **MAIN
          SX6    X6+1              NEW LS VALUE                       **MAIN
          SA6    PAR3                                                 **MAIN
          SX6    B0                                                   **MAIN
          PL     X7,COMPLD                                            **MAIN
          EQ     B0,B0,PATCOM                                         **MAIN
*                                                                       MAIN
 TEMP     DATA   B77                                                    MAIN
 SIXO     DATA   B20000000000000000006                                  MAIN
 TENO     DATA   B20000000000000000012                                  MAIN
 FLAG     DATA   0                                                    **MAIN
 C1       DATA   1                                                      MAIN
 ARG1     DATA 0                                                      **MAIN
 ARG2     DATA 0                                                      **MAIN
 ARG3     DATA 0                                                      **MAIN
 ARG4     DATA 0                                                      **MAIN
 ARG5     DATA 0                                                      **MAIN
 N2       DATA 0                                                      **MAIN
          END                                                           MAIN
      SUBROUTINE STORES (IENTRY)                                        MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE NUMBER OF STORES AND PYLONS          MAIN
C     DROPPED AND THE CORRESPONDING DROPPED WEIGHT.                     MAIN
C     STORES AND PYLONS ARE DROPPED AT ENTRY 3 BY A DIRECT              MAIN
C     CALL FROM OPTION 18.                                              MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 46), IDRSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 47), IDRSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 48), IDRSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 49), JDRPS1)                                  MAIN
      EQUIVALENCE (XNSEG( 50), JDRPS2)                                  MAIN
      EQUIVALENCE (XNSEG( 51), JDRPS3)                                  MAIN
      EQUIVALENCE (XNSEG(246), NDROP1)                                  MAIN
      EQUIVALENCE (XNSEG(247), NDROP2)                                  MAIN
      EQUIVALENCE (XNSEG(248), NDROP3)                                  MAIN
      EQUIVALENCE (XNSEG(238), NSDROP)                                  MAIN
      EQUIVALENCE (XNSEG( 37), NSTOR1)                                  MAIN
      EQUIVALENCE (XNSEG( 38), NSTOR2)                                  MAIN
      EQUIVALENCE (XNSEG( 39), NSTOR3)                                  MAIN
      EQUIVALENCE (XNSEG(239), STYP1 )                                  MAIN
      EQUIVALENCE (XNSEG(240), STYP2 )                                  MAIN
      EQUIVALENCE (XNSEG(241), STYP3 )                                  MAIN
      EQUIVALENCE (XNSEG(242), SPTYP1)                                  MAIN
      EQUIVALENCE (XNSEG(243), SPTYP2)                                  MAIN
      EQUIVALENCE (XNSEG(244), SPTYP3)                                  MAIN
      EQUIVALENCE (XNSEG(245), TOTSWD)                                  MAIN
      EQUIVALENCE (XNSEG( 43), WGTSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 44), WGTSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 45), WGTSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 40), WGTS1 )                                  MAIN
      EQUIVALENCE (XNSEG( 41), WGTS2 )                                  MAIN
      EQUIVALENCE (XNSEG( 42), WGTS3 )                                  MAIN
C                                                                       MAIN
      DATA NTAPE6 /6/                                                   MAIN
      GO TO (1000,2000,3000),IENTRY                                     MAIN
 1000 CONTINUE                                                          MAIN
C     TOTAL STORES DROPPED                                              MAIN
      NDROP1=0                                                          MAIN
      NDROP2=0                                                          MAIN
      NDROP3=0                                                          MAIN
C     STORE/PYLON DROP TYPE INDICATORS                                  MAIN
      IDRSP1=0                                                          MAIN
      IDRSP2=0                                                          MAIN
      IDRSP3=0                                                          MAIN
C     NUMBER OF STORE OR STORE/PYLON COMBINATIONS TO BE DROPPED         MAIN
      JDRPS1=0                                                          MAIN
      JDRPS2=0                                                          MAIN
      JDRPS3=0                                                          MAIN
C     STORE DROPPED WEIGHT                                              MAIN
      STDRW1=0.0                                                        MAIN
      STDRW2=0.0                                                        MAIN
      STDRW3=0.0                                                        MAIN
      RETURN                                                            MAIN
 2000 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
 3000 CONTINUE                                                          MAIN
C                                                                       MAIN
C     STORE DROP INCOMPATIBILITY TESTS                                  MAIN
      I=1                                                               MAIN
      IDUM=IDRSP1                                                       MAIN
      JDUM=JDRPS1                                                       MAIN
      IF(IDRSP1.EQ.0.AND.JDRPS1.NE.0) GO TO 3400                        MAIN
      I=2                                                               MAIN
      IDUM=IDRSP2                                                       MAIN
      JDUM=JDRPS2                                                       MAIN
      IF(IDRSP2.EQ.0.AND.JDRPS2.NE.0) GO TO 3400                        MAIN
      I=3                                                               MAIN
      IDUM=IDRSP3                                                       MAIN
      JDUM=JDRPS3                                                       MAIN
      IF(IDRSP3.EQ.0.AND.JDRPS3.NE.0) GO TO 3400                        MAIN
C                                                                       MAIN
      IF(JDRPS1.EQ.0) GO TO 2100                                        MAIN
      NDROP1=MIN0(NSTOR1, NDROP1+JDRPS1 )                               MAIN
      DROP=FLOAT(NDROP1)                                                MAIN
      STDRW1=DROP*WGTS1                                                 MAIN
      IF(IDRSP1.EQ.2) STDRW1=STDRW1+DROP*WGTSP1                         MAIN
      JDRPS1=0                                                          MAIN
 2100 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(JDRPS2.EQ.0) GO TO 2200                                        MAIN
      NDROP2=MIN0(NSTOR2, NDROP2+JDRPS2 )                               MAIN
      DROP=FLOAT(NDROP2)                                                MAIN
      STDRW2=DROP*WGTS2                                                 MAIN
      IF(IDRSP2.EQ.2) STDRW2=STDRW2+DROP*WGTSP2                         MAIN
      JDRPS2=0                                                          MAIN
 2200 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(JDRPS3.EQ.0) GO TO 2300                                        MAIN
      NDROP3=MIN0(NSTOR3, NDROP3+JDRPS3 )                               MAIN
      DROP=FLOAT(NDROP3)                                                MAIN
      STDRW3=DROP*WGTS3                                                 MAIN
      IF(IDRSP3.EQ.2) STDRW3=STDRW3+DROP*WGTSP3                         MAIN
      JDRPS3=0                                                          MAIN
 2300 CONTINUE                                                          MAIN
C     TOTAL STORE AND PYLON WEIGHT DROPPED                              MAIN
      TOTSWD=STDRW1+STDRW2+STDRW3                                       MAIN
C                                                                       MAIN
C     TOTAL NUMBER OF STORE PAIRS DROPPED                               MAIN
      NSDROP=NDROP1+NDROP2+NDROP3                                       MAIN
      STYP1=NSTOR1-NDROP1                                               MAIN
      STYP2=NSTOR2-NDROP2                                               MAIN
      STYP3=NSTOR3-NDROP3                                               MAIN
      SPTYP1=NSTOR1                                                     MAIN
      SPTYP2=NSTOR2                                                     MAIN
      SPTYP3=NSTOR3                                                     MAIN
      IF(IDRSP1.EQ.2) SPTYP1=STYP1                                      MAIN
      IF(IDRSP2.EQ.2) SPTYP2=STYP2                                      MAIN
      IF(IDRSP3.EQ.2) SPTYP3=STYP3                                      MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
 3400 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      WRITE(NTAPE6,9001) I,IDUM,JDUM                                    MAIN
 9000 FORMAT(1H0,39H SUBROUTINE STORES. STORE DROP FAILURE )            MAIN
 9001 FORMAT(1H0,14H STORE SYSTEM ,I1,/                                 MAIN
     *       1H0,10H IDRPS1 = ,I2,/                                     MAIN
     *       1H0,10H JDRPS1 = ,I2)                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE STORWT                                                 MAIN
C                                                                       MAIN
C     STORE AND PYLON DROP AND RETURN WEIGHT                            MAIN
C     NOTE THAT SUBROUTINE TNKSWT MUST BE CALLED BEFORE STORWT          MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 46), IDRSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 47), IDRSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 48), IDRSP3)                                  MAIN
      EQUIVALENCE (XNSEG( 37), NSTOR1)                                  MAIN
      EQUIVALENCE (XNSEG( 38), NSTOR2)                                  MAIN
      EQUIVALENCE (XNSEG( 39), NSTOR3)                                  MAIN
      EQUIVALENCE (XNSEG(342), STWDRP)                                  MAIN
      EQUIVALENCE (XNSEG(341), STWRET)                                  MAIN
      EQUIVALENCE (XNSEG(227), TSWT  )                                  MAIN
      EQUIVALENCE (XNSEG( 40), WGTS1 )                                  MAIN
      EQUIVALENCE (XNSEG( 41), WGTS2 )                                  MAIN
      EQUIVALENCE (XNSEG( 42), WGTS3 )                                  MAIN
      EQUIVALENCE (XNSEG( 43), WGTSP1)                                  MAIN
      EQUIVALENCE (XNSEG( 44), WGTSP2)                                  MAIN
      EQUIVALENCE (XNSEG( 45), WGTSP3)                                  MAIN
C                                                                       MAIN
      NTAPE6=6                                                          MAIN
      TSWRET=0.0                                                        MAIN
      TSWDRP=0.0                                                        MAIN
      TSWDR1=0.0                                                        MAIN
      TSWDR2=0.0                                                        MAIN
      TSWDR3=0.0                                                        MAIN
      TSWRT1=0.0                                                        MAIN
      TSWRT2=0.0                                                        MAIN
      TSWRT3=0.0                                                        MAIN
      TSWTSV=TSWT                                                       MAIN
      TSWT=0.0                                                          MAIN
      DUMM=(WGTSP1+WGTS1)*FLOAT(NSTOR1)                                 MAIN
C                                                                       MAIN
      IF(IDRSP1.EQ.0) GO TO 100                                         MAIN
      IF(IDRSP1.EQ.1) TSWDR1=WGTS1*FLOAT(NSTOR1)                        MAIN
      IF(IDRSP1.EQ.2) TSWDR1=DUMM                                       MAIN
 100  CONTINUE                                                          MAIN
      TSWRT1=DUMM-TSWDR1                                                MAIN
      TSW1=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
C                                                                       MAIN
      DUMM=(WGTSP2+WGTS2)*FLOAT(NSTOR2)                                 MAIN
      IF(IDRSP2.EQ.0) GO TO 200                                         MAIN
      IF(IDRSP2.EQ.1) TSWDR2=WGTS2*FLOAT(NSTOR2)                        MAIN
      IF(IDRSP2.EQ.2) TSWDR2=DUMM                                       MAIN
 200  CONTINUE                                                          MAIN
      TSWRT2=DUMM-TSWDR2                                                MAIN
      TSW2=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
C                                                                       MAIN
      DUMM=(WGTSP3+WGTS3)*FLOAT(NSTOR3)                                 MAIN
      IF(IDRSP3.EQ.0) GO TO 300                                         MAIN
      IF(IDRSP3.EQ.1) TSWDR3=WGTS3*FLOAT(NSTOR3)                        MAIN
      IF(IDRSP3.EQ.2) TSWDR3=DUMM                                       MAIN
 300  CONTINUE                                                          MAIN
      TSWRT3=DUMM-TSWDR3                                                MAIN
      TSW3=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
      TSWDRP=TSWDR1+TSWDR2+TSWDR3                                       MAIN
      TSWRET=TSWRT1+TSWRT2+TSWRT3                                       MAIN
      STWDRP=TSWDRP                                                     MAIN
      STWRET=TSWRET                                                     MAIN
C                                                                       MAIN
      CALL PAGHED                                                       MAIN
      WRITE(NTAPE6,9000)                                                MAIN
 9000 FORMAT(25X,47H STORE SYSTEM DROP AND RETURN WEIGHT STATEMENT )    MAIN
      I = 1                                                             MAIN
      WRITE(NTAPE6,9001) I,NSTOR1,TSWDR1,TSWRT1,I,TSW1                  MAIN
 9001 FORMAT(1H0, 13HSTORE SYSTEM I2/                                   MAIN
     1       1H0, 19X, 25H NUMBER OF STORE PAIRS = I2/                  MAIN
     2       1H0, 19X, 25H POUNDS DROPPED        = G12.5/               MAIN
     3       1H0, 19X, 25H POUNDS RETURNED       = G12.5/               MAIN
     41H0, 30HTOTAL WEIGHT FOR STORE SYSTEM I1, 13H LESS FUEL = G12.5)  MAIN
      I = 2                                                             MAIN
      WRITE(NTAPE6,9001) I,NSTOR2,TSWDR2,TSWRT2,I,TSW2                  MAIN
      I = 3                                                             MAIN
      WRITE(NTAPE6,9001) I,NSTOR3,TSWDR3,TSWRT3,I,TSW3                  MAIN
      WRITE(NTAPE6,9002) TSWDRP,TSWRET,TSWT                             MAIN
 9002 FORMAT(45H0 TOTAL STORE SYSYEM DROP WEIGHT           = G12.5/     MAIN
     1       45H0 TOTAL STORE SYSTEM RETURN WEIGHT         = G12.5/     MAIN
     2       45H0 TOTAL STORE SYSTEM WEIGHT                = G12.5)     MAIN
C                                                                       MAIN
C                                                                       MAIN
      TSWT=TSWT+TSWTSV                                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
          IDENT  STRMOV           .CALL STRMOV(S1,C1,N,S2,C2,ER)        MAIN
*                                                                       MAIN
*    THIS SUBROUTINE MOVES N CHARACTERS FROM STRING S1 STARTING WITH    MAIN
*    CHAR. C1 TO STRING S2. THE FIRST CHAR. IS PLACED IN CHAR. C2 OF S2.MAIN
*     IF THERE IS SOMETHING WRONG IN THE SPECIFICATIONS, I.E.           MAIN
*     C1.LE.0.OR.N.LT.0.OR.C2.LE.0, AND STRMOV IS CALLED WITH ONLY 5    MAIN
*     ARGUMENTS NO MOVING OF CHARACTERS IS PERFORMED. IF STRMOV IS      MAIN
*     CALLED WITH G ARGUMENTS ER IS SET EQUAL TO,                       MAIN
*        ER=0  SPECIFICATIONS O.K.                                      MAIN
*        ER=-1 SPECIFICATIONS WRONG                                     MAIN
*                                                                       MAIN
          ENTRY     STRMOV                                              MAIN
 +        VFD 36/0HSTRMOV,24/6                                          MAIN
 STRMOV   BSSZ      1                                                   MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SA2  A1+3                                                     MAIN
          SB4  X2                                                       MAIN
          SA2  A1+4                                                     MAIN
          SB5  X2                                                       MAIN
          SA2  A1+5                                                     MAIN
          SB6  X2                                                       MAIN
          SA1       STRMOV                                              MAIN
          LX1       30                                                  MAIN
          SA1       X1-1                                                MAIN
          LX1       36                                                  MAIN
          MX2       6                                                   MAIN
          BX1       X1*X2                                               MAIN
          LX1       6                                                   MAIN
          SA0       X1-6                                                MAIN
          SX2       A0                                                  MAIN
          NZ        X2,P1                                               MAIN
          SA6       B6                                                  MAIN
 P1       SA1       B2                                                  MAIN
          ZR        X1,ERROR                                            MAIN
          NG        X1,ERROR                                            MAIN
          SA1       B5                                                  MAIN
          ZR        X1,ERROR                                            MAIN
          NG        X1,ERROR                                            MAIN
          SA1       B3                                                  MAIN
          ZR        X1,FIN1                                             MAIN
          PL        X1,OK                                               MAIN
 ERROR    SX2       A0                                                  MAIN
          NZ        X2,STRMOV                                           MAIN
          SX7       -1                                                  MAIN
          SA7       A6                                                  MAIN
          EQ        B0,B0,STRMOV                                        MAIN
 OK       SA1       B2                                                  MAIN
          SB2       1                                                   MAIN
          SA4       TENO                                                MAIN
          SX1       X1+9                                                MAIN
          PX3       B0,X1                                               MAIN
          NX3       B6,X3                                               MAIN
          NX5       B6,X4                                               MAIN
          FX3       X3/X5                                               MAIN
          UX5       B6,X3                                               MAIN
          LX3       B6,X5                                               MAIN
          SB1       B1-B2                                               MAIN
          SB1       X3+B1         .K=(C1+9)/10+ START ADRESS OF S1      MAIN
          SX1       X1+B2                                               MAIN
          PX3       B0,X3                                               MAIN
          DX3       X4*X3                                               MAIN
          UX6       B6,X3                                               MAIN
          IX6       X1-X6         .K1=(C1+10)-K*10 (FIRST CHAR.MOVED)   MAIN
          SA1       B5                                                  MAIN
          SX1       X1+9                                                MAIN
          PX3       B0,X1                                               MAIN
          NX3       B6,X3                                               MAIN
          NX5       B6,X4                                               MAIN
          FX3       X3/X5                                               MAIN
          UX5       B6,X3                                               MAIN
          LX3       B6,X5                                               MAIN
          SB4       B4-B2                                               MAIN
          SB4       X3+B4         .J=(C2+9)/10+ START ADRESS OF S2      MAIN
          SX1       X1+B2                                               MAIN
          PX3       B0,X3                                               MAIN
          DX3       X4*X3                                               MAIN
          UX7       B6,X3                                               MAIN
          IX7       X1-X7         .J1=(C2+10)-J*10 (FIRST CHAR. MOVED TOMAIN
          BX3       X6                                                  MAIN
          BX4       X7                                                  MAIN
          SA1       B1            .MOVE S1(K) TO X1                     MAIN
          SA5       SIXO                                                MAIN
          SX6       X6-1                                                MAIN
          ZR        X6,L1                                               MAIN
          PX6       B0,X6                                               MAIN
          DX6       X5*X6                                               MAIN
          UX6       B6,X6                                               MAIN
          SB6       X6                                                  MAIN
          LX1       B6,X1         .LEFT SHIFT X1 (K1-1) CHAR.           MAIN
 L1       SA2       B4            .MOVE S2(J) TO X2                     MAIN
          SX7       X7-1                                                MAIN
          SB6       B0                                                  MAIN
          ZR        X7,L2                                               MAIN
          PX7       B0,X7                                               MAIN
          DX7       X5*X7                                               MAIN
          UX7       B6,X7                                               MAIN
          SB6       X7                                                  MAIN
          LX2       B6,X2         .LEFT SHIFT X2 (J1-1) CHAR.           MAIN
 L2       SB5       B0+60                                               MAIN
          SB6       B5-B6         .L=60-(J1-1)*6                        MAIN
          BX6       X3                                                  MAIN
          SA3       B3            .N1=N (NUMBER OF CHAR. TO BE MOVED)   MAIN
          SB7       B0+11                                               MAIN
          SB3       X6                                                  MAIN
          SB5       X4                                                  MAIN
          SB3       B7-B3         .K2=11-K1                             MAIN
          SB5       B7-B5         .J2=11-J1                             MAIN
          SB7       B0+6                                                MAIN
          SA4       TEMP1                                               MAIN
          SA5       TEMP2                                               MAIN
          BX6       X5                                                  MAIN
 L3       BX2       X2*X4         .MASK OUT LEFT CHAR. OF X2            MAIN
          BX5       X1*X6         .MASK OUT RIGHT 9 CHAR. OF X1         MAIN
          BX2       X2+X5                                               MAIN
          SX3       X3-1          .N1=N1-1                              MAIN
          ZR        X3,FIN        .IF(N1.EQ.0) GO TO FIN (ALL CHAR. MOVEMAIN
          SB3       B3-B2         .K2=K2-1                              MAIN
          LX1       B7,X1                                               MAIN
          NE        B3,B0,L5      .IF(K2.EQ.0) GO TO L4 (NO CHAR. LEFT  MAIN
          SB1       B1+B2         .K=K+1                                MAIN
          SA1       B1            .MOVE S1(K) TO X1                     MAIN
          SB3       B0+10         .K2=10                                MAIN
 L5       SB5       B5-B2         .J2=J2-1                              MAIN
          LX2       B7,X2                                               MAIN
          SB6       B6-B7                                               MAIN
          NE        B5,B0,L3                                            MAIN
          BX7       X2                                                  MAIN
          SA7       B4            .MOVE X2 TO S2(J)                     MAIN
          SB4       B4+B2         .J=J+1                                MAIN
          SA2       B4            .MOVE S2(J) TO X2                     MAIN
          SB5       B0+10         .J2=10                                MAIN
          SB6       B0+60         .L=60                                 MAIN
          EQ        B0,B0,L3                                            MAIN
 FIN      LX7       B6,X2         .SHIFT X2 LEFT L PLACES               MAIN
          SA7       B4            .MOVE X2 TO S2(J)                     MAIN
 FIN1     SX1       A0                                                  MAIN
          NZ        X1,STRMOV                                           MAIN
          SX7       B0                                                  MAIN
          SA7       A6                                                  MAIN
          EQ        B0,B0,STRMOV                                        MAIN
 TENO     DATA      20000000000000000012B                               MAIN
 SIXO     DATA      20000000000000000006B                               MAIN
 TEMP1    DATA      00777777777777777777B                               MAIN
 TEMP2    DATA      77000000000000000000B                               MAIN
          END                                                           MAIN
      SUBROUTINE TABRE                                                  MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      COMMON /TABNAM/ MAXT, STABLE(126), LOCS(126), IS(126)             MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (INC   , RDATA( 82))                                  MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      EQUIVALENCE (XNSEG(440), LOCSAC)                                  MAIN
      EQUIVALENCE (XNSEG(495), LOCTFF)                                  MAIN
      EQUIVALENCE (XNSEG(659), LOCCLM)                                  MAIN
      EQUIVALENCE(XNSEG(700),LOCCLA)                                    MAIN
      EQUIVALENCE (XNSEG(738),LOCENG)                                   MAIN
      EQUIVALENCE   (XNSEG(752),LOCCLZ )                                MAIN
      INTEGER  LOCENG(10)                                               MAIN
      INTEGER LOCTFF(21)                                                MAIN
      INTEGER LOCSAC(50)                                                MAIN
      INTEGER END                                                       MAIN
      INTEGER SYMBOL                                                    MAIN
      INTEGER STABLE                                                    MAIN
      LOGICAL TABSTP                                                    MAIN
      DATA MAXTAB /6000/                                                MAIN
      DATA END /6HEND   /                                               MAIN
      DO 5 I=1,MAXT                                                     MAIN
 5    IS(I) = 1                                                         MAIN
      NSUM = 0                                                          MAIN
      WRITE (6,3)                                                       MAIN
 3    FORMAT (36X,43HTABLE SIZES FOR EACH TABLE USED IN THIS RUN)       MAIN
   10 CONTINUE                                                          MAIN
      CALL FETCH                                                        MAIN
      IF(SYMBOL .EQ. END)  GO TO 21                                     MAIN
      NTSIZE = INC                                                      MAIN
      DO 15 J=1,MAXT                                                    MAIN
      IF (SYMBOL .NE. STABLE(J) ) GO TO 15                              MAIN
      IS(J) = NTSIZE                                                    MAIN
      NSUM = NSUM + NTSIZE                                              MAIN
      IF(NX .GT. 0)  CALL IVNAME                                        MAIN
      GO TO 10                                                          MAIN
 15   CONTINUE                                                          MAIN
      NERROR = NERROR +1                                                MAIN
      CALL LINES (2)                                                    MAIN
      WRITE (6,24) SYMBOL                                               MAIN
 24   FORMAT (1H0,36X,A6,28HDOES NOT EXIST IN TABLE LIST)               MAIN
      GO TO 10                                                          MAIN
C     ........                                                          MAIN
   21 CONTINUE                                                          MAIN
      IF (NSUM .LE. MAXTAB) GO TO 200                                   MAIN
      TABSTP = .TRUE.                                                   MAIN
      NERROR = NERROR +1                                                MAIN
      CALL LINES (2)                                                    MAIN
      WRITE(6,23)  NSUM, MAXTAB                                         MAIN
 23   FORMAT (1H0,10X,18HTOTAL TABLE SIZES I4,                          MAIN
     *                17HEXCEED MAX. SIZE I4)                           MAIN
 200  KONT = 1                                                          MAIN
      DO 250 I=1,MAXT                                                   MAIN
      LOCS(I) = KONT                                                    MAIN
      KONT = KONT + IS(I)                                               MAIN
  250 CONTINUE                                                          MAIN
      CALL LINES(1)                                                     MAIN
      WRITE(6, 22) KONT                                                 MAIN
   22 FORMAT(36X, 33HTOTAL TABLE SIZE FOR THIS RUN IS I5)               MAIN
C                                                                       MAIN
      CALL TSRCH(6HATAB01,LOCSAC(1),50,IER)                             MAIN
      CALL TSRCH(6HTTAB01,LOCTFF(1),21,IER)                             MAIN
      CALL TSRCH(6HMTAB01, LOCTZ, 2, N)                                 MAIN
      CALL TSRCH(6HCLMTAB, LOCCLM, 1, IER)                              MAIN
      CALL TSRCH(6HCLATAB,LOCCLA, 1, IER)                               MAIN
C     LOCATE DUAL ENGINE DATA TABLES                                    MAIN
      CALL TSRCH(6HETAB01,LOCENG(1),10,IER)                             MAIN
      CALL TSRCH(6HCLZTAB,LOCCLZ,1,IER)                                 MAIN
C                                                                       MAIN
      IF(N .LT. 0)  GO TO 210                                           MAIN
      NERROR = NERROR +1                                                MAIN
      WRITE(6, 1)                                                       MAIN
    1 FORMAT(52H SPACE NOT RESERVED FOR MISSION SEGMENT TABLE SEGTAB)   MAIN
      LOCTZ = 1                                                         MAIN
  210 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      FUNCTION TAB UP 1 (AZ, X, AX, LX)                                 MAIN
      REAL AZ(LX), AX(LX), X                                            MAIN
      CALL GT I1 I2 (X, AX, LX, I1, I2)                                 MAIN
      TAB UP 1 = SL VALU  ( AZ(I1), AZ(I2), AX(I1), X, AX(I2) )         MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TAKEOF                                                 MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG(115), SFC   )                                  MAIN
      EQUIVALENCE (XNSEG(583), SREF  )                                  MAIN
      EQUIVALENCE (XNSEG(584), SPLG  )                                  MAIN
      EQUIVALENCE (XNSEG(585), CDPLG )                                  MAIN
      EQUIVALENCE (XNSEG(586), AG    )                                  MAIN
      EQUIVALENCE (XNSEG(587), AMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(588), WINCID)                                  MAIN
      EQUIVALENCE (XNSEG(589), ARTHEO)                                  MAIN
      EQUIVALENCE (XNSEG(590), WSLEFC)                                  MAIN
      EQUIVALENCE (XNSEG(591), CLATOT)                                  MAIN
      EQUIVALENCE (XNSEG(592), CL0   )                                  MAIN
      EQUIVALENCE (XNSEG(593), TRATIO)                                  MAIN
      EQUIVALENCE (XNSEG(594), DFK   )                                  MAIN
      EQUIVALENCE (XNSEG(595), GRNDFT)                                  MAIN
      EQUIVALENCE (XNSEG(596), CD0   )                                  MAIN
      EQUIVALENCE (XNSEG(599), BFOBEX)                                  MAIN
      EQUIVALENCE (XNSEG(600), FLAPDT)                                  MAIN
      EQUIVALENCE (XNSEG(601), CFOCAV)                                  MAIN
      EQUIVALENCE (XNSEG(605), W0    )                                  MAIN
      EQUIVALENCE (XNSEG(606), FN0   )                                  MAIN
      EQUIVALENCE (XNSEG(607), XIS0  )                                  MAIN
      IF(W0 .LE. 0.0)  RETURN                                           MAIN
      XIS0 = FN0*3600.0/FFR                                             MAIN
      CALL PAGHED                                                       MAIN
      WRITE(6,2) SREF, SPLG, CDPLG, AG, AMAXG, WINCID, ARTHEO, WSLEFC   MAIN
    2 FORMAT(1H , 20X, ,29HINPUT TO TAKEOFF CALCULATIONS,               MAIN
     1/57H WING REFERENCE AREA  (SF)                        SREF  =G15.7MAIN
     2/57H FLAT PLATE AREA OF GEAR (SF)                     SPLG  =G15.7MAIN
     3/57H FLAT PLATE DRAG COEFF OF GEAR                    CDPLG =G15.7MAIN
     4/57H GROUND ROLL BODY ANGLE (DEG)                     AG    =G15.7MAIN
     5/57H MAXIMUM GROUND ROTATION ANGLE (DEG)              AMAXG =G15.7MAIN
     6/57H WING INCIDENCE (DEG)                             WINCID=G15.7MAIN
     7/57H THEORETICAL WING ASPECT RATIO                    ARTHEO=G15.7MAIN
     8/57H WING LEADING EDGE SWEEP ANGLE (DEG)              WSLEFC=G15.7MAIN
     *)                                                                 MAIN
      WRITE(6,3)                                                        MAIN
     1CLATOT, CL0, TRATIO, DFK, GRNDFT, CD0, W0, FN0, FFR, SFC, XIS0,   MAIN
     2BFOBEX, FLAPDT, CFOCAV                                            MAIN
    3 FORMAT(                                                           MAIN
     9 57H TOTAL LIFT LIFT CURVE SLOPE (PER DEG)            CLATOT=G15.7MAIN
     */57H LIFT COEF AT ZERO ANGLE OF ATTACK                CL0   =G15.7MAIN
     1/57H WING TAPER RATIO                                 TRATIO=G15.7MAIN
     2/57H INDUCED DRAG FACTOR                              DFK   =G15.7MAIN
     3/57H GROUND ROLL FRICTION COEFFICIENT                 GRNDFT=G15.7MAIN
     4/57H DRAG COEFF AT ZERO LIFT                          CD0   =G15.7MAIN
     5/57H WEIGHT AT START OF TAKE-OFF (LB)                 W0    =G15.7MAIN
     6/57H TAKE-OFF THRUST (LB)                             FN0   =G15.7MAIN
     6/57H FUEL FLOW RATE  (LBS/HR)                         FFR   =G15.7MAIN
     6/57H SPECIFIC FUEL CONSUMPTION  (1.0/HR)              SFC   =G15.7MAIN
     7/57H SPECIFIC IMPULSE AT TAKE-OFF (SEC)               XIS0  =G15.7MAIN
     8/57H FLAP SPAN TO EXPOSED WING SPAN RATIO             BFOBEX=G15.7MAIN
     9/57H FLAPDEFLECTION (DEG)                             FLAPDT=G15.7MAIN
     */57H AVERAGE FLAP CHORD TO WING CHORD RATIO           CF0CAV=G15.7MAIN
     *)                                                                 MAIN
      CALL TAKOFF                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TANKS  (IENTRY)                                        MAIN
C                                                                       MAIN
C     THIS SUBROUTINE COMPUTES THE NUMBER OF TANKS  AND PYLONS          MAIN
C     DROPPED AND THE CORRESPONDING DROPPED WEIGHT.                     MAIN
C     TANKS  AND PYLONS ARE DROPPED AT ENTRY 3 BY A DIRECT              MAIN
C     CALL FROM OPTION 19, OR BY A CALL FROM ENSEG WHEN                 MAIN
C     AUTOMATIC TANK DROP IS REQUESTED.                                 MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 64), IDRTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 65), IDRTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 66), IDRTP3)                                  MAIN
      EQUIVALENCE (XNSEG(252), JDRPT1)                                  MAIN
      EQUIVALENCE (XNSEG(253), JDRPT2)                                  MAIN
      EQUIVALENCE (XNSEG(254), JDRPT3)                                  MAIN
      EQUIVALENCE (XNSEG(249), MDROP1)                                  MAIN
      EQUIVALENCE (XNSEG(250), MDROP2)                                  MAIN
      EQUIVALENCE (XNSEG(251), MDROP3)                                  MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG(256), TOTTFD)                                  MAIN
      EQUIVALENCE (XNSEG(255), TOTTWD)                                  MAIN
      EQUIVALENCE (XNSEG(260), TPTYP1)                                  MAIN
      EQUIVALENCE (XNSEG(261), TPTYP2)                                  MAIN
      EQUIVALENCE (XNSEG(262), TPTYP3)                                  MAIN
      EQUIVALENCE (XNSEG(257), TTYP1 )                                  MAIN
      EQUIVALENCE (XNSEG(258), TTYP2 )                                  MAIN
      EQUIVALENCE (XNSEG(259), TTYP3 )                                  MAIN
      EQUIVALENCE (XNSEG( 58), WGTFT1)                                  MAIN
      EQUIVALENCE (XNSEG( 59), WGTFT2)                                  MAIN
      EQUIVALENCE (XNSEG( 60), WGTFT3)                                  MAIN
      EQUIVALENCE (XNSEG( 61), WGTTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 62), WGTTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 63), WGTTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 55), WGTT1 )                                  MAIN
      EQUIVALENCE (XNSEG( 56), WGTT2 )                                  MAIN
      EQUIVALENCE (XNSEG( 57), WGTT3 )                                  MAIN
C                                                                       MAIN
      GO TO (1000,2000,3000),IENTRY                                     MAIN
 1000 CONTINUE                                                          MAIN
      NTAPE6=6                                                          MAIN
C     TOTAL TANKS DROPPED                                               MAIN
      MDROP1=0                                                          MAIN
      MDROP2=0                                                          MAIN
      MDROP3=0                                                          MAIN
C     TANK/PYLON DROP TYPE INDICATORS                                   MAIN
      IDRTP1=0                                                          MAIN
      IDRTP2=0                                                          MAIN
      IDRTP3=0                                                          MAIN
C     NUMBER OF TANKS OR TANK/PYLONS TO BE DROPPED                      MAIN
      JDRPT1=0                                                          MAIN
      JDRPT2=0                                                          MAIN
      JDRPT3=0                                                          MAIN
C     TANK DROPPED WEIGHT                                               MAIN
      TKDRW1=0.0                                                        MAIN
      TKDRW2=0.0                                                        MAIN
      TKDRW3=0.0                                                        MAIN
      RETURN                                                            MAIN
 2000 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
 3000 CONTINUE                                                          MAIN
C                                                                       MAIN
C     TANK  DROP INCOMPATIBILITY TESTS                                  MAIN
      I=1                                                               MAIN
      IDUM=IDRTP1                                                       MAIN
      JDUM=JDRPT1                                                       MAIN
      IF(IDRTP1.EQ.0.AND.JDRPT1.NE.0) GO TO 3400                        MAIN
      I=2                                                               MAIN
      IDUM=IDRTP2                                                       MAIN
      JDUM=JDRPT2                                                       MAIN
      IF(IDRTP2.EQ.0.AND.JDRPT2.NE.0) GO TO 3400                        MAIN
      I=3                                                               MAIN
      IDUM=IDRTP3                                                       MAIN
      JDUM=JDRPT3                                                       MAIN
      IF(IDRTP3.EQ.0.AND.JDRPT3.NE.0) GO TO 3400                        MAIN
C                                                                       MAIN
      IF(JDRPT1.EQ.0) GO TO 2100                                        MAIN
      MDROP1=MIN0(NTANK1, MDROP1+JDRPT1 )                               MAIN
      DROP=FLOAT(MDROP1)                                                MAIN
      TKDRW1=DROP*WGTT1                                                 MAIN
      IF(IDRTP1.EQ.2) TKDRW1=TKDRW1+DROP*WGTTP1                         MAIN
      JDRPT1=0                                                          MAIN
 2100 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(JDRPT2.EQ.0) GO TO 2200                                        MAIN
      MDROP2=MIN0(NTANK2, MDROP2+JDRPT2 )                               MAIN
      DROP=FLOAT(MDROP2)                                                MAIN
      TKDRW2=DROP*WGTT2                                                 MAIN
      IF(IDRTP2.EQ.2) TKDRW2=TKDRW2+DROP*WGTTP2                         MAIN
      JDRPT2=0                                                          MAIN
 2200 CONTINUE                                                          MAIN
C                                                                       MAIN
      IF(JDRPT3.EQ.0) GO TO 2300                                        MAIN
      MDROP3=MIN0(NTANK3, MDROP3+JDRPT3 )                               MAIN
      DROP=FLOAT(MDROP3)                                                MAIN
      TKDRW3=DROP*WGTT3                                                 MAIN
      IF(IDRTP3.EQ.2) TKDRW3=TKDRW3+DROP*WGTTP3                         MAIN
      JDRPT3=0                                                          MAIN
 2300 CONTINUE                                                          MAIN
C     TOTAL WEIGHT OF TANKS AND PYLONS DROPPED                          MAIN
      TOTTWD=TKDRW1+TKDRW2+TKDRW3                                       MAIN
C     TOTAL TANK FUEL DROPPED OR CONSUMED                               MAIN
      TOTTFD=WGTFT1*FLOAT(MDROP1)+WGTFT2*FLOAT(MDROP2)                  MAIN
     *               +WGTFT3*FLOAT(MDROP3)                              MAIN
C     TOTAL NUMBER OF TANK PAIRS DROPPED                                MAIN
      NTDROP=MDROP1+MDROP2+MDROP3                                       MAIN
      TTYP1=NTANK1-MDROP1                                               MAIN
      TTYP2=NTANK2-MDROP2                                               MAIN
      TTYP3=NTANK3-MDROP3                                               MAIN
      TPTYP1=NTANK1                                                     MAIN
      TPTYP2=NTANK2                                                     MAIN
      TPTYP3=NTANK3                                                     MAIN
      IF(IDRTP1.EQ.2) TPTYP1=TTYP1                                      MAIN
      IF(IDRTP2.EQ.2) TPTYP2=TTYP2                                      MAIN
      IF(IDRTP3.EQ.2) TPTYP3=TTYP3                                      MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
 3400 CONTINUE                                                          MAIN
      WRITE(NTAPE6,9000)                                                MAIN
      WRITE(NTAPE6,9001) I,IDUM,JDUM                                    MAIN
 9000 FORMAT(1H0,37H SUBROUTINE TANKS. TANK DROP FAILURE )              MAIN
 9001 FORMAT(1H0,13H TANK SYSTEM ,I1,/                                  MAIN
     *       1H0,10H IDRPT1 = ,I2,/                                     MAIN
     *       1H0,10H JDRPT1 = ,I2)                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TLAERO(TRATIO, ARTHEO, WSLEFC,                         MAIN
     1                  CLMAXB, ACLMAX, DCLMAX)                         MAIN
C                                                                       MAIN
      REAL TABLAM(12), TABC1(12), TABC2(12)                             MAIN
      REAL TABF(28), TABCL(28), TABAC(28)                               MAIN
      REAL TABFF(16), TABDCL(16)                                        MAIN
C                                                                       MAIN
      DATA TABLAM /.0, .1, .16, .2, .3, .4, .5, .6, .7, .8, .9, 1.0/    MAIN
C                                                                       MAIN
      DATA TABC1 /.0, .22, .4, .48, .5, .43, .31, .2, .14, .08, .04, .0/MAIN
C                                                                       MAIN
      DATA TABC2 /.0, .21, .38, .5, .91, 1.09, 1.05, 1.0, .95, .91, .88,MAIN
     1            .85/                                                  MAIN
C                                                                       MAIN
C                                                                       MAIN
      DATA TABF /0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, MAIN
     1           1.1, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, MAIN
     2           3.2, 3.4, 3.6, 4.0, 6.0, 15.0/                         MAIN
C                                                                       MAIN
      DATA TABCL /0.480, 0.760, 0.920, 1.018, 1.083, 1.140, 1.170, 1.190MAIN
     1,           1.195, 1.185, 1.170, 1.150, 1.115, 1.060, 1.004, 0.955MAIN
     2,           0.910, 0.880, 0.850, 0.836, 0.821, 0.810, 0.802, 0.800MAIN
     3,           0.800, 0.800, 0.800, 0.800/                           MAIN
C                                                                       MAIN
      DATA TABAC /35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0, MAIN
     1            34.6, 34.0, 33.2, 32.0, 30.0, 28.0, 26.5, 25.2, 24.1, MAIN
     2            23.2, 22.7, 22.1, 21.8, 21.5, 21.3, 21.0, 20.8, 20.0, MAIN
     3            20.0/                                                 MAIN
C                                                                       MAIN
C                                                                       MAIN
      DATA TABFF /0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.,MAIN
     1            11., 12., 13., 14., 15./                              MAIN
C                                                                       MAIN
      DATA TABDCL /-.11, -.1, -.079, -.045, .0, .055, .115, .173, .230, MAIN
     1             .280, .333, .364, .356, .312, .220, .085/            MAIN
C                                                                       MAIN
C     ...   ...   ...                                                   MAIN
      C1 = TABUP1(TABC1, TRATIO, TABLAM, 12)                            MAIN
      C2 = TABUP1(TABC2, TRATIO, TABLAM, 12)                            MAIN
      F= (C1 + 1.0) * ARTHEO * COS(WSLEFC/57.29)                        MAIN
      CLMAXB = TABUP1(TABCL, F, TABF, 28)                               MAIN
      ACLMAX = TABUP1(TABAC, F, TABF, 28)                               MAIN
      FF = (C2 + 1.0) * ARTHEO * SIN(WSLEFC / 57.29) / COS(WSLEFC/57.29)MAIN
      DCLMAX = TABUP1(TABDCL, FF, TABFF, 16)                            MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TLU(X,LOCZ,Y)                                          MAIN
      COMMON /COMTAB/ C(1)                                              MAIN
      EQUIVALENCE (N,Z)                                                 MAIN
      LOCZM1=LOCZ-1                                                     MAIN
      Z=C(LOCZ)                                                         MAIN
      DO 1I=1,N                                                         MAIN
      J=2*I+LOCZM1                                                      MAIN
      IF (C(J)-X)1,6,2                                                  MAIN
 1    CONTINUE                                                          MAIN
      GO TO 5                                                           MAIN
 2    IF(J.GT.(LOCZM1+2))GO TO 4                                        MAIN
      J = 4 + LOCZM1                                                    MAIN
 5    CALL ERROR(LOCZ)                                                  MAIN
      WRITE(6,10) X                                                     MAIN
 10   FORMAT(1X,9HARGUMENT ,1PE15.7)                                    MAIN
 4    Y=C(J-1)+(C(J+1)-C(J-1))*(X-C(J-2))/(C(J)-C(J-2))                 MAIN
      RETURN                                                            MAIN
 6    Y=C(J+1)                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TLU1(N,TABLE,TIME,NDEP,ANS,IND)                        MAIN
      DIMENSION TABLE(2),ANS(6)                                         MAIN
C                                                                       MAIN
C*****TWO DIMENSIONAL TABLE LOOK-UP ROUTINE                             MAIN
C                                                                       MAIN
      IND=0                                                             MAIN
      DO 5 I=1,N                                                        MAIN
      IF(TABLE(I)-TIME) 5,10,15                                         MAIN
 5    CONTINUE                                                          MAIN
      IND=1                                                             MAIN
      N1=N                                                              MAIN
 8    DO 9 K=1,NDEP                                                     MAIN
      NSUB=K*N+N1                                                       MAIN
 9    ANS(K)=TABLE(NSUB)                                                MAIN
      RETURN                                                            MAIN
 10   N1=I                                                              MAIN
      GO TO 8                                                           MAIN
 15   IF(I.EQ.1) GO TO 21                                               MAIN
      TEMP=(TABLE(I-1)-TIME)/(TABLE(I-1)-TABLE(I))                      MAIN
      DO 20 K=1,NDEP                                                    MAIN
      NSUB=K*N+I                                                        MAIN
 20   ANS(K)=TABLE(NSUB-1)+(TABLE(NSUB)-TABLE(NSUB-1))*TEMP             MAIN
      RETURN                                                            MAIN
 21   N1=1                                                              MAIN
      IND=1                                                             MAIN
      GO TO 8                                                           MAIN
      END                                                               MAIN
      SUBROUTINE TNKSWT                                                 MAIN
C                                                                       MAIN
C                                                                       MAIN
C     TANK AND PYLON DROP AND RETURN WEIGHT                             MAIN
C                                                                       MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 64), IDRTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 65), IDRTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 66), IDRTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 67), IPLF1 )                                  MAIN
      EQUIVALENCE (XNSEG( 68), IPLF2 )                                  MAIN
      EQUIVALENCE (XNSEG( 69), IPLF3 )                                  MAIN
      EQUIVALENCE (XNSEG( 52), NTANK1)                                  MAIN
      EQUIVALENCE (XNSEG( 53), NTANK2)                                  MAIN
      EQUIVALENCE (XNSEG( 54), NTANK3)                                  MAIN
      EQUIVALENCE (XNSEG(344), TSWDRP)                                  MAIN
      EQUIVALENCE (XNSEG(343), TSWRET)                                  MAIN
      EQUIVALENCE (XNSEG(227), TSWT  )                                  MAIN
      EQUIVALENCE (XNSEG( 61), WGTTP1)                                  MAIN
      EQUIVALENCE (XNSEG( 62), WGTTP2)                                  MAIN
      EQUIVALENCE (XNSEG( 63), WGTTP3)                                  MAIN
      EQUIVALENCE (XNSEG( 55), WGTT1 )                                  MAIN
      EQUIVALENCE (XNSEG( 56), WGTT2 )                                  MAIN
      EQUIVALENCE (XNSEG( 57), WGTT3 )                                  MAIN
C                                                                       MAIN
      NTAPE6=6                                                          MAIN
      TSWRET=0.0                                                        MAIN
      TSWDRP=0.0                                                        MAIN
      TSWDR1=0.0                                                        MAIN
      TSWDR2=0.0                                                        MAIN
      TSWDR3=0.0                                                        MAIN
      TSWRT1=0.0                                                        MAIN
      TSWRT2=0.0                                                        MAIN
      TSWRT3=0.0                                                        MAIN
      DUMM=(WGTTP1+WGTT1)*FLOAT(NTANK1)                                 MAIN
      TSWT=0.0                                                          MAIN
C                                                                       MAIN
      IF(IPLF1.NE.0) GO TO 101                                          MAIN
      IF(IDRTP1.EQ.0) GO TO 100                                         MAIN
      IF(IDRTP1.EQ.1) TSWDR1=WGTT1*FLOAT(NTANK1)                        MAIN
      IF(IDRTP1.EQ.2) TSWDR1=DUMM                                       MAIN
 100  CONTINUE                                                          MAIN
      TSWRT1=DUMM-TSWDR1                                                MAIN
      TSW1=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
C                                                                       MAIN
 101  CONTINUE                                                          MAIN
      DUMM=(WGTTP2+WGTT2)*FLOAT(NTANK2)                                 MAIN
      IF(IPLF2.NE.0) GO TO 201                                          MAIN
      IF(IDRTP2.EQ.0) GO TO 200                                         MAIN
      IF(IDRTP2.EQ.1) TSWDR2=WGTT2*FLOAT(NTANK2)                        MAIN
      IF(IDRTP2.EQ.2) TSWDR2=DUMM                                       MAIN
 200  CONTINUE                                                          MAIN
      TSWRT2=DUMM-TSWDR2                                                MAIN
      TSW2=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
 201  CONTINUE                                                          MAIN
C                                                                       MAIN
      DUMM=(WGTTP3+WGTT3)*FLOAT(NTANK3)                                 MAIN
      IF(IPLF3.NE.0) GO TO 301                                          MAIN
      IF(IDRTP3.EQ.0) GO TO 300                                         MAIN
      IF(IDRTP3.EQ.1) TSWDR3=WGTT3*FLOAT(NTANK3)                        MAIN
      IF(IDRTP3.EQ.2) TSWDR3=DUMM                                       MAIN
 300  CONTINUE                                                          MAIN
      TSWRT3=DUMM-TSWDR3                                                MAIN
      TSW3=DUMM                                                         MAIN
      TSWT=TSWT+DUMM                                                    MAIN
 301  CONTINUE                                                          MAIN
      TSWDRP=TSWDR1+TSWDR2+TSWDR3                                       MAIN
      TSWRET=TSWRT1+TSWRT2+TSWRT3                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
      WRITE(NTAPE6,9000)                                                MAIN
 9000 FORMAT(25X,46H TANK SYSTEM DROP AND RETURN WEIGHT STATEMENT )     MAIN
      I = 1                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK1,TSWDR1,TSWRT1,I,TSW1                  MAIN
 9001 FORMAT(1H0, 13H TANK SYSTEM I2/                                   MAIN
     1       1H0, 19X, 25H NUMBER OF TANK PAIRS  = I2/                  MAIN
     2       1H0, 19X, 25H POUNDS DROPPED        = G12.5/               MAIN
     3       1H0, 19X, 25H POUNDS RETURNED       = G12.5/               MAIN
     41H0, 30H TOTAL WEIGHT FOR TANK SYSTEM I1, 13H LESS FUEL = G12.5)  MAIN
      I = 2                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK2,TSWDR2,TSWRT2,I,TSW2                  MAIN
      I = 3                                                             MAIN
      WRITE(NTAPE6,9001) I,NTANK3,TSWDR3,TSWRT3,TSW3                    MAIN
      WRITE(NTAPE6,9002) TSWDRP,TSWRET,TSWT                             MAIN
 9002 FORMAT(45H0 TOTAL TANK SYSTEM DROP WEIGHT            = G12.5/     MAIN
     1       45H0 TOTAL TANK SYSTEM RETURN WEIGHT          = G12.5/     MAIN
     2       45H0 TOTAL TANK SYSTEM WEIGHT                 = G12.5)     MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TOP                                                    MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG( 98), PSET  )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(193), MGIVEN)                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      LOGICAL MGIVEN                                                    MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(1),ASPEED),(ATMOS(8),Q),(ATMOS(5),PR)          MAIN
      INTEGER PSET, PSSTOR                                              MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES ALTITUDE (CEILING) FOR GIVEN RATE OF CLIMB ANDMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      N=0                                                               MAIN
      RCT=0.0                                                           MAIN
      IF(IPXX(1))      WRITE (6,11)                                     MAIN
 11   FORMAT(* TOP    WEIGHT      H     AM      FN     DRAG   RC(FT/SEC)MAIN
     1*)                                                                MAIN
      PSSTOR=PSET                                                       MAIN
      RCR=AMAX1(RC,1.0)/60.0                                            MAIN
      PSET=1                                                            MAIN
      CL=1.0                                                            MAIN
      H = 0.0                                                           MAIN
      IF(AM .LE. 0.0)  RETURN                                           MAIN
      MGIVEN = .TRUE.                                                   MAIN
      PR=WT/(1481.352*AM*AM*CL*XQSW)                                    MAIN
      CALL XALT                                                         MAIN
      H=AMIN1(H,154000.0)                                               MAIN
      HTT=H                                                             MAIN
      DH=H/10.0                                                         MAIN
      HT=H                                                              MAIN
      H=HT+DH                                                           MAIN
C                                                                       MAIN
      DO 1 I=1,11                                                       MAIN
      H=H-DH                                                            MAIN
      CALL ATMOSD                                                       MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WT/QS                                                          MAIN
      CALL DRAG                                                         MAIN
      CALL ENDAT                                                        MAIN
      RC=(FN-DRT)*AM*ASPEED/WT                                          MAIN
      IF(IPXX(1))      WRITE(6,10) WT, H,AM,FN,DRT,RC                   MAIN
 10   FORMAT(1H ,7X,F8.0,F9.0,F6.3,2F8.0,F10.3)                         MAIN
      IF(RC .GE. RCR)  GO TO 2                                          MAIN
      HT=H                                                              MAIN
      HTT=H                                                             MAIN
 1    RCT=RC                                                            MAIN
C     ........                                                          MAIN
      GO TO 8                                                           MAIN
    2 CONTINUE                                                          MAIN
      IF(H .GE. HT)  GO TO 6                                            MAIN
      HL=H                                                              MAIN
      RCL=RC                                                            MAIN
C                                                                       MAIN
      DO 5 I=1,10                                                       MAIN
      BB=(HT-HL)/(RCT-RCL)                                              MAIN
      AA=HT-RCT*BB                                                      MAIN
      H=AA+BB*RCR                                                       MAIN
      CALL ATMOSD                                                       MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WT/QS                                                          MAIN
      CALL DRAG                                                         MAIN
      CALL ENDAT                                                        MAIN
      RC=(FN-DRT)*AM*ASPEED/WT                                          MAIN
      IF(RC.GT.RCR) GO TO 12                                            MAIN
      HT=H                                                              MAIN
      RCT=RC                                                            MAIN
      GO TO 13                                                          MAIN
 12   HL=H                                                              MAIN
      RCL=RC                                                            MAIN
   13 CONTINUE                                                          MAIN
      IF(IPXX(1))      WRITE(6,10) WT, H,AM,FN,DRT,RC                   MAIN
 5    CONTINUE                                                          MAIN
C     ........                                                          MAIN
 6    RCM=RC*60.0                                                       MAIN
 8    PSET=PSSTOR                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TSRCH (SYM2,LOC2,N2,IER)                               MAIN
      COMMON /TABNAM/ MAXT, STABLE(126), LOCS(126), IS(126)             MAIN
      INTEGER LOC2(N2)                                                  MAIN
      DO 1000 I=1,MAXT                                                  MAIN
      IF (SYM2 .NE. STABLE(I) ) GO TO 1000                              MAIN
      JM = I                                                            MAIN
      DO 500 J=1,N2                                                     MAIN
      LOC2(J) = LOCS(JM)                                                MAIN
 500  JM = JM+1                                                         MAIN
      IER =-1                                                           MAIN
      RETURN                                                            MAIN
 1000 CONTINUE                                                          MAIN
      IER = 1                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TZRGDB(TZ, RG, N)                                      MAIN
      REAL TZ(N), RG(N)                                                 MAIN
      WRITE(25, 1) TZ                                                   MAIN
    1 FORMAT(4H TZ=5(G12.5, 1H,)/ (4X, 5(G12.5, 1H,)))                  MAIN
      WRITE(25, 2) RG                                                   MAIN
    2 FORMAT(4H RG=5(G12.5, 1H,)/ (4X, 5(G12.5, 1H,)))                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE UNIT25(IENTRY, ENDF)                                   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C        CONTROLS DATA BASE I/O FOR GENERALIZED PERFORMANCE CALCULATIONSMAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      LOGICAL ENDF                                                      MAIN
      ENDF = .FALSE.                                                    MAIN
      IF(IENTRY .EQ. 2)  GO TO 2                                        MAIN
      WRITE(25)  XNSEG                                                  MAIN
      RETURN                                                            MAIN
C     ......                                                            MAIN
    2 CONTINUE                                                          MAIN
      READ(25)  XNSEG                                                   MAIN
      IF(EOF(25)) 3, 4                                                  MAIN
    3 CONTINUE                                                          MAIN
      ENDF = .TRUE.                                                     MAIN
    4 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
C     ......                                                            MAIN
      END                                                               MAIN
          IDENT  UNPAC                                                  MAIN
          ENTRY  UNPAC                                                  MAIN
 +        VFD 30/0HUNPAC,30/4                                           MAIN
 UNPAC    BSSZ 1                                                        MAIN
          SB1  X1                                                       MAIN
          SA2  A1+1                                                     MAIN
          SB2  X2                                                       MAIN
          SA2  A1+2                                                     MAIN
          SB3  X2                                                       MAIN
          SA2  A1+3                                                     MAIN
          SB4  X2                                                       MAIN
          SA1  B1          . LOAD A INTO X1.                            MAIN
          SA3  B3          .                                            MAIN
          LX1  1           . ROTATE X1 LEFT BY 1.                       MAIN
          SA2  B2          .                                            MAIN
          SB3  X3          . B3 = J.                                    MAIN
          SB5  X2+58       . B5 = I+58.                                 MAIN
          LX1  B3,X1       . ROTATE X1 BY J.  BITS I-J AT RIGHT OF X1.  MAIN
          SB5  B5-B3       . B5 = I+58-J (NO. OF BITS TO GENERATE IN    MAIN
          SA2  MASK        . THE MASK BY SIGN EXTENSION.                MAIN
          GE   B5,B0,KJJ01   TEST FOR SPECIAL CASE I=0,J=59  1.104      MAIN
          SX2  B0          . SET MASK TO ZERO                1.104      MAIN
 KJJ01    AX2  B5,X2       . GENERATE MASK                   1.104      MAIN
          BX6  -X2*X1      . MASK OUT UNUSED PORTION OF X1.             MAIN
          SA6  B4          .                                            MAIN
          EQ        B0,B0,UNPAC                                         MAIN
 MASK     DATA 40000000000000000000B                                    MAIN
          END                                                           MAIN
      SUBROUTINEVMAX                                                    MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 85), DRT   )                                  MAIN
      EQUIVALENCE (XNSEG( 92), FN    )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(122), VX    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(349), IPXX  )                                  MAIN
      LOGICAL IPXX(10)                                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(9),QMSQR)                                      MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              CALCULATES MAXIMUM MACH NUMBER FOR STEADY LEVEL FLIGHT   MAIN
C                  GIVEN ALTITUDE AND WEIGHT                            MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      IF(IPXX(3))      WRITE(6,41) WT,H                                 MAIN
 41   FORMAT(57H0VMAX    MACH  (FN-DRT)   THRUST      DRAG     CL    WT MAIN
     1=,F8.0,3X,3HH =F8.0)                                              MAIN
      DAM=0.2                                                           MAIN
      CALLALTA                                                          MAIN
      QSFAC=XQSW*QMSQR                                                  MAIN
      QS=WT/CLZZ                                                        MAIN
      AM=SQRT(QS/QSFAC)                                                 MAIN
      CL=CLZZ                                                           MAIN
      ASM=AM                                                            MAIN
      CALLDRAG                                                          MAIN
      CALLENDAT                                                         MAIN
      FNEX=FN-DRT                                                       MAIN
      IF(FNEX)5,9,9                                                     MAIN
 5    DO 6 I=1,3                                                        MAIN
      DAM=0.1*DAM                                                       MAIN
      DO 4 J=1,100                                                      MAIN
      AM=AM+DAM                                                         MAIN
      QS=QSFAC*AM**2                                                    MAIN
      CL=WT/QS                                                          MAIN
      CALL DRAG                                                         MAIN
      CALL ENDAT                                                        MAIN
      FNEX=FN-DRT                                                       MAIN
      IF(IPXX(3))      WRITE(6,40) AM ,FNEX,FN,DRT,CL                   MAIN
 40   FORMAT(2H ,5X,F7.4,3F10.0,F7.4)                                   MAIN
      IF(FNEX) 4,6,6                                                    MAIN
 4    CONTINUE                                                          MAIN
      AM =0.0                                                           MAIN
      VX =0.0                                                           MAIN
      GO TO 13                                                          MAIN
 6    AM=AM-DAM                                                         MAIN
      AM=AM+DAM                                                         MAIN
 9    VX=AM                                                             MAIN
      N=50                                                              MAIN
      DAM=0.20                                                          MAIN
      DO22J=1,9                                                         MAIN
      DO 10 I = 1, N                                                    MAIN
      AM=AM+DAM                                                         MAIN
      CL=WT/(QSFAC*AM*AM)                                               MAIN
      QS=QSFAC*AM*AM                                                    MAIN
      CALLDRAG                                                          MAIN
      CALLENDAT                                                         MAIN
      FNEX=FN-DRT                                                       MAIN
      IF(IPXX(3))      WRITE(6,40) AM ,FNEX,FN,DRT,CL                   MAIN
      IF(FNEX)23,13,10                                                  MAIN
 10   CONTINUE                                                          MAIN
      AM=AM+DAM                                                         MAIN
 23   AM=AM-DAM                                                         MAIN
      N=1                                                               MAIN
  22  DAM=0.500*DAM                                                     MAIN
 13   RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XTRACT                                                 MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (CARD  , RDATA(  1))                                  MAIN
      EQUIVALENCE (SYMBOL, RDATA( 81))                                  MAIN
      EQUIVALENCE (INC   , RDATA( 82))                                  MAIN
      EQUIVALENCE (OP    , RDATA( 83))                                  MAIN
      EQUIVALENCE (NERROR, RDATA( 86))                                  MAIN
      EQUIVALENCE (NCOL  , RDATA( 91))                                  MAIN
      EQUIVALENCE (KSTART, RDATA( 92))                                  MAIN
      EQUIVALENCE (PAROPT, RDATA( 93))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      EQUIVALENCE (X     , RDATA( 95))                                  MAIN
      EQUIVALENCE (IX    , RDATA( 95))                                  MAIN
      EQUIVALENCE (K, KSTART)                                           MAIN
      EQUIVALENCE (NCOL, L)                                             MAIN
      EQUIVALENCE (INCX, A)                                             MAIN
      INTEGER CARD(80)                                                  MAIN
      INTEGER INCX(30)                                                  MAIN
      INTEGER A(30)                                                     MAIN
      INTEGER SYMBOL                                                    MAIN
      INTEGER OP                                                        MAIN
      LOGICAL ETYPE                                                     MAIN
      LOGICAL PAROPT                                                    MAIN
      LOGICAL NLTYPE                                                    MAIN
      REAL X(36)                                                        MAIN
      INTEGER IX(36)                                                    MAIN
      INTEGER RP, BCD, OCT, PAR, EQS, SLASH, BLANK, POINT, COMMA        MAIN
      DATA LP /6H(     /                                                MAIN
      DATA RP /6H)     /                                                MAIN
      DATA INT /6HINT   /                                               MAIN
      DATA BCD /6HBCD   /                                               MAIN
      DATA OCT /6HOCT   /                                               MAIN
      DATA PAR /6HPAR   /                                               MAIN
      DATA EQS /6H=     /                                               MAIN
      DATA SLASH /6H/     /                                             MAIN
      DATA BLANK /6H      /                                             MAIN
      DATA POINT /6H.     /                                             MAIN
      DATA COMMA/6H,     /                                              MAIN
      KSTART=0                                                          MAIN
      M = 0                                                             MAIN
      CALL XNLTST(NLTYPE)                                               MAIN
      IF(NLTYPE)  GO TO 300                                             MAIN
      KSTART = 1                                                        MAIN
      SYMBOL = BLANK                                                    MAIN
      OP = BLANK                                                        MAIN
      INC = 1                                                           MAIN
      NX = 0                                                            MAIN
      DO 10 I=K,L                                                       MAIN
      IF(CARD(I) .EQ. LP)  GO TO 100                                    MAIN
      IF(CARD(I) .EQ. SLASH)  GO TO 200                                 MAIN
      IF(CARD(I) .EQ. EQS)  GO TO 300                                   MAIN
      M = M +1                                                          MAIN
      IF(M .GT. 10)  GO TO 11                                           MAIN
      CALL PUT(SYMBOL, M, CARD(I))                                      MAIN
   10 CONTINUE                                                          MAIN
      IF(M .EQ. L)  RETURN                                              MAIN
   11 CONTINUE                                                          MAIN
      CALL LINES(1)                                                     MAIN
      WRITE(6, 12)                                                      MAIN
   12 FORMAT(10(4H    ), 25H ERROR ON ABOVE DATA CARD, 10(4H ***))      MAIN
      NERROR = NERROR +1                                                MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
      K = K +M +1                                                       MAIN
      M = 0                                                             MAIN
      DO 110 I=K,L                                                      MAIN
      IF(CARD(I) .EQ. RP)  GO TO 120                                    MAIN
      M = M +1                                                          MAIN
      IF(M .GT. 10)  GO TO 11                                           MAIN
      INCX(M) = CARD(I)                                                 MAIN
  110 CONTINUE                                                          MAIN
      GO TO 11                                                          MAIN
  120 CONTINUE                                                          MAIN
      CALL BCDINT(INCX, M, INC)                                         MAIN
      K = K +M +1                                                       MAIN
      M = 0                                                             MAIN
      IF(CARD(K) .EQ. SLASH)  GO TO 200                                 MAIN
      IF(CARD(K) .EQ. EQS)  GO TO 300                                   MAIN
      IF(K .GE. L)  RETURN                                              MAIN
      GO TO 11                                                          MAIN
  200 CONTINUE                                                          MAIN
      K = K +M +1                                                       MAIN
      M = 0                                                             MAIN
      DO 210 I=K,L                                                      MAIN
      IF(CARD(I) .EQ. SLASH)  GO TO 220                                 MAIN
      M = M +1                                                          MAIN
      IF(M .GT. 10)  GO TO 11                                           MAIN
      CALL PUT(OP, M, CARD(I))                                          MAIN
  210 CONTINUE                                                          MAIN
      GO TO 11                                                          MAIN
  220 CONTINUE                                                          MAIN
      K = K +M +1                                                       MAIN
      IF(K .GE. NCOL)  RETURN                                           MAIN
      M = 0                                                             MAIN
      IF(CARD(K) .EQ. EQS)  GO TO 300                                   MAIN
      GO TO 11                                                          MAIN
C                                                                       MAIN
  300 CONTINUE                                                          MAIN
      K = K +M +1                                                       MAIN
      IF(K .GT. NCOL)  GO TO 11                                         MAIN
      M = 0                                                             MAIN
      NX = 0                                                            MAIN
C     ...   ...   ...   ...                                             MAIN
      IF(OP .EQ. BLANK)  GO TO 1100                                     MAIN
      IF(OP .EQ. INT)  GO TO 1200                                       MAIN
      IF(OP .EQ. BLANK)  GO TO 1100                                     MAIN
      IF(OP .EQ. INT)  GO TO 1200                                       MAIN
      IF(OP .EQ. BCD)  GO TO 1300                                       MAIN
      IF(OP .EQ. OCT)  GO TO 1400                                       MAIN
      IF(OP .EQ. PAR)  GO TO 1500                                       MAIN
      RETURN                                                            MAIN
 1100 CONTINUE                                                          MAIN
C     E FORMAT DATA                                                     MAIN
      ETYPE = .FALSE.                                                   MAIN
      J = 0                                                             MAIN
      DO 1110 I=K,L                                                     MAIN
      IF(CARD(I) .EQ. COMMA)  GO TO 1105                                MAIN
      M = M +1                                                          MAIN
      IF(M .GT. 30)  GO TO 11                                           MAIN
      IF(CARD(I) .EQ. POINT)  ETYPE = .TRUE.                            MAIN
      A(M) = CARD(I)                                                    MAIN
      IF(I .EQ. L)  GO TO 1105                                          MAIN
      GO TO 1110                                                        MAIN
 1105 CONTINUE                                                          MAIN
      J = J +1                                                          MAIN
      IF(ETYPE)  GO TO 1106                                             MAIN
      CALL BCDINT(A, M, IX(J))                                          MAIN
      M = 0                                                             MAIN
      GO TO 1110                                                        MAIN
 1106 CONTINUE                                                          MAIN
      CALL BCDDEC(A, M, X(J))                                           MAIN
      M = 0                                                             MAIN
      ETYPE = .FALSE.                                                   MAIN
 1110 CONTINUE                                                          MAIN
      NX = J                                                            MAIN
      RETURN                                                            MAIN
 1200 CONTINUE                                                          MAIN
C     I FORMAT DATA                                                     MAIN
      GO TO 1100                                                        MAIN
 1300 CONTINUE                                                          MAIN
C     A FORMAT DATA                                                     MAIN
      I = 1                                                             MAIN
      IX(1) = BLANK                                                     MAIN
      J = 0                                                             MAIN
      DO 1305 M=K,L                                                     MAIN
      J = J +1                                                          MAIN
      IF(J .LE. 6)  GO TO 1302                                          MAIN
      J = 1                                                             MAIN
      I = I +1                                                          MAIN
      IX(I) = BLANK                                                     MAIN
 1302 CONTINUE                                                          MAIN
      CALL PUT(IX(I), J, CARD(M))                                       MAIN
 1305 CONTINUE                                                          MAIN
      NX = I                                                            MAIN
      RETURN                                                            MAIN
 1400 CONTINUE                                                          MAIN
C     O FORMAT DATA                                                     MAIN
      IF(NCOL .LT. 41)  NCOL = 20                                       MAIN
      DO 1410 I=1,NCOL                                                  MAIN
      IF(CARD(I) .EQ. COMMA)  GO TO 1410                                MAIN
      M = M +1                                                          MAIN
      CALL PUT(A, M, CARD(I))                                           MAIN
 1410 CONTINUE                                                          MAIN
      NX = 1                                                            MAIN
      DECODE(20, 1401, A) X(NX)                                         MAIN
 1401 FORMAT(O20)                                                       MAIN
      IF(NCOL .EQ. 20)  RETURN                                          MAIN
      NX = 2                                                            MAIN
      DECODE(20, 1401, A(3))  X(2)                                      MAIN
      RETURN                                                            MAIN
 1500 CONTINUE                                                          MAIN
      PAROPT = .TRUE.                                                   MAIN
      OP = INT                                                          MAIN
      GO TO 1200                                                        MAIN
      END                                                               MAIN
      SUBROUTINE XXINIT                                                 MAIN
      COMMON/QXABRT/JWRIT                                               MAIN
      COMMON/QXMACH/LWORD,IGLOBL                                        MAIN
      COMMON/QXOPTN/XX(28)                                              MAIN
      COMMON/QXSWCH/IFIND,ITYPE,IDIAG,IERR,IABRT                        MAIN
      COMMON/QXSYOZ/JOPEN,JOUT                                          MAIN
      LOGICAL XX                                                        MAIN
      DATA XX(7)/0/                                                     MAIN
      LWORD = 10                                                        MAIN
      JWRIT=0                                                           MAIN
      IGLOBL=0                                                          MAIN
      DO 6 I=1,6                                                        MAIN
    6 XX(I)=.FALSE.                                                     MAIN
      DO 8 I=8,28                                                       MAIN
    8 XX(I)=.FALSE.                                                     MAIN
      IFIND=0                                                           MAIN
      ITYPE=0                                                           MAIN
      IDIAG=0                                                           MAIN
      IERR=0                                                            MAIN
      IABRT=0                                                           MAIN
      JOPEN=0                                                           MAIN
      JOUT=77                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FILL80                                                 MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (NOLIST, RDATA( 90))                                  MAIN
      LOGICAL NOLIST                                                    MAIN
      DATA IP /6H.     /                                                MAIN
   10 CONTINUE                                                          MAIN
      READ(5,1) C                                                       MAIN
    1 FORMAT(8A10)                                                      MAIN
      IF(NOLIST)  GO TO 110                                             MAIN
      CALL LINES(1)                                                     MAIN
      WRITE(6,2) C                                                      MAIN
    2 FORMAT(1H , 8A10)                                                 MAIN
  110 CONTINUE                                                          MAIN
      CALL GET(C, 1, L)                                                 MAIN
      IF(L .EQ. IP)  GO TO 10                                           MAIN
      LC = 80                                                           MAIN
      CALL QXSQZ(LC,C)                                                  MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NDATA3                                                 MAIN
      COMMON /DICNAM/ LCOUNT, NAME(504), LOC(504)                       MAIN
      DATA (NAME(I), I=379,504) /                                       MAIN
     *6HLTT10X,6HLTT10Y,6HLTT10W,6HLTT10Z,6HNAT10 ,6HLTT11X,6HLTT11Y,   MAIN
     *6HLTT11W,6HLTT11Z,6HNAT11 ,6HINDMAP,6HINDMHP,6HHF    ,6HENDPTH,   MAIN
     *6HIPATH ,6HINDTRN,6HCLIMBQ,6HZMAX10,6HZMAX11,6HZMAX12,6HLOCCLM,   MAIN
     *6HINDCLM,6HICLMX ,6HICLMY ,6HZLTAB ,6HINDZLT,6HGLIMIT,6HAMSW1 ,   MAIN
     *6HAMSW2 ,6HAMLOW ,6HALAMTD,6HALPMIN,6HALPMAX,6HICLAX ,6HICLAY ,   MAIN
     *6HINDCLA,6HLOCCLA,6HALPHAD,6HCASA  ,6HICLAZ ,6HARG   ,6HICLAW ,   MAIN
     *6HIA43Z ,6HIA44Z ,6HIA45Z ,6HCT    ,6HCTMAX ,6HINDE01,6HINDE02,   MAIN
     *6HINDE03,6HINDE04,6HINDE05,6HINDE06,6HINDE07,6HINDE08,6HINDE09,   MAIN
     *6HINDE10,6HIE03X ,6HIE04X ,6HIE05X ,6HIE06X ,6HIE06Z ,6HIE07X ,   MAIN
     *6HIE08X ,6HIE09X ,6HIE10X ,6HIEOP  ,6HIESCAL,6HAINLET,6HDELWNG,   MAIN
     *6HDELIN ,6HIPROP ,6HPEXIT ,6HTJCAIR,6HLOCENG,6HAMAXTJ,6HAMINRJ,   MAIN
     *6HCLOUT ,6HFNFACT,6HLOCCLZ,6HINDCLZ,6HICLZX ,6HICLZY ,6HIENFLG ,  MAIN
     *6HINDTOA,6HCLMXTO,6HALMXTO,6HTMINTJ,6HTMINRJ,6HALPLIM,6HIPDENG,   MAIN
     *6HIASCAL,6HIDBMHP,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,   MAIN
     *6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     ,6H*     /   MAIN
C                                                                       MAIN
      DATA   (LOC(I), I=379,504) /                                      MAIN
     *638     ,639     ,640     ,641     ,642     ,643     ,644     ,   MAIN
     *645     ,646     ,647     ,648     ,649     ,650     ,651     ,   MAIN
     *652     ,653     ,654     ,655     ,656     ,657     ,659     ,   MAIN
     *660     ,661     ,662     ,663     ,688     ,690     ,691     ,   MAIN
     *692     ,693     ,694     ,695     ,696     ,697     ,698     ,   MAIN
     *699     ,700     ,701     ,702     ,703     ,704     ,705     ,   MAIN
     *706     ,707     ,708     ,709     ,710     ,711     ,712     ,   MAIN
     *713     ,714     ,715     ,716     ,717     ,718     ,719     ,   MAIN
     *720     ,721     ,722     ,723     ,724     ,725     ,726     ,   MAIN
     *727     ,728     ,729     ,730     ,731     ,732     ,733     ,   MAIN
     *734     ,735     ,736     ,737     ,738     ,748     ,749     ,   MAIN
     *750     ,751     ,752     ,753     ,754     ,755     ,756      ,  MAIN
     *757     ,758     ,759     ,760     ,761     ,762     ,763     ,   MAIN
     *764     ,765     ,3000    ,3000    ,3000    ,3000    ,3000    ,   MAIN
     *3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,   MAIN
     *3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,   MAIN
     *3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,   MAIN
     *3000    ,3000    ,3000    ,3000    ,3000    ,3000    ,3000    /   MAIN
      LCOUNT = 471                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE SEGINI(IN, TZ)                                         MAIN
      COMMON /COMSEG/  XNSEG(775)                                       MAIN
      REAL TZ(1)                                                        MAIN
      EQUIVALENCE (XNSEG( 32), WGTO  )                                  MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 86), DAC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(113), RN    )                                  MAIN
      EQUIVALENCE (XNSEG(114), RXC   )                                  MAIN
      EQUIVALENCE (XNSEG(117), TAC   )                                  MAIN
      EQUIVALENCE (XNSEG(118), TTC   )                                  MAIN
      EQUIVALENCE (XNSEG(119), TTR   )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(135), XNZZ  )                                  MAIN
      EQUIVALENCE (XNSEG(159), ZX5   )                                  MAIN
      EQUIVALENCE (XNSEG(160), ZX6   )                                  MAIN
      EQUIVALENCE (XNSEG(162), ZX8   )                                  MAIN
      EQUIVALENCE (XNSEG(174), E10   )                                  MAIN
      EQUIVALENCE (XNSEG(196), E11   )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(220), PAYWT )                                  MAIN
      EQUIVALENCE (XNSEG(222), FUEL  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(232), TCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(233), RCMAX )                                  MAIN
      EQUIVALENCE (XNSEG(234), RANGE )                                  MAIN
      EQUIVALENCE (XNSEG(235), TIME  )                                  MAIN
      EQUIVALENCE (XNSEG(236), ZX10  )                                  MAIN
      EQUIVALENCE (XNSEG(332), PAIRS )                                  MAIN
      EQUIVALENCE (XNSEG(348),RETWGT )                                  MAIN
      EQUIVALENCE (XNSEG(580), KKK   )                                  MAIN
      EQUIVALENCE (XNSEG(581), IATZ  )                                  MAIN
      IF(IN .EQ. 2)  GO TO 2                                            MAIN
      AM = TZ(1)                                                        MAIN
      H = TZ(2)                                                         MAIN
      WT = TZ(3)                                                        MAIN
      AMLIM = TZ(4)                                                     MAIN
      QLIM = TZ(5)                                                      MAIN
      ZX6=0.0                                                           MAIN
      ZX8 = WGTO                                                        MAIN
      ZX10 = PAYWT                                                      MAIN
C     TZ(13) = RETWGT                                                   MAIN
C     COMMENTED OUT BY DSH AND HLR JUNE 75                              MAIN
      XNZZ=1.0                                                          MAIN
      E10 = 0.0                                                         MAIN
      E11 = 0.0                                                         MAIN
      TCMAX=0.0                                                         MAIN
      TAC=0.0                                                           MAIN
      TTC=0.0                                                           MAIN
      TTR=0.0                                                           MAIN
      RCMAX=0.0                                                         MAIN
      RN =0.0                                                           MAIN
      RXC=0.0                                                           MAIN
      DAC=0.0                                                           MAIN
      RANGE=0.0                                                         MAIN
      TIME=0.0                                                          MAIN
      KKK=0                                                             MAIN
      IATZ=0                                                            MAIN
      WTKEP=WT                                                          MAIN
      ZX5 = PAIRS                                                       MAIN
      RETURN                                                            MAIN
    2 CONTINUE                                                          MAIN
      RCMAX=0.0                                                         MAIN
      TCMAX=0.0                                                         MAIN
      RN=0.0                                                            MAIN
      TTR=0.0                                                           MAIN
      DAC=0.0                                                           MAIN
      TAC=0.0                                                           MAIN
      RXC=0.0                                                           MAIN
      TTC=0.0                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QXFTXT(LS,S)                                           MAIN
      COMMON/QXFILB/LX,X(133)                                           MAIN
      DIMENSION S(10)                                                   MAIN
      INTEGER ER                                                        MAIN
      IF (LS.LE.0) RETURN                                               MAIN
      IF (LS+LX.LE.1326) GO TO 10                                       MAIN
      CALL QXERR(77,77HA GENERATE (*,1,$) STRING OR A BUILD .S. STRING  MAIN
     1HAS EXCEEDED 1326 CHARACTERS)                                     MAIN
      RETURN                                                            MAIN
   10 CALL STRMOV(S,1,LS,X,LX+1,ER)                                     MAIN
      LX=LX+LS                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE TAKOFF                                                 MAIN
      COMMON/COMSEG/  XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 91), FFR   )                                  MAIN
      EQUIVALENCE (XNSEG(583), SREF  )                                  MAIN
      EQUIVALENCE (XNSEG(584), SPLG  )                                  MAIN
      EQUIVALENCE (XNSEG(585), CDPLG )                                  MAIN
      EQUIVALENCE (XNSEG(586), AG    )                                  MAIN
      EQUIVALENCE (XNSEG(587), AMAXG )                                  MAIN
      EQUIVALENCE (XNSEG(588), WINCID)                                  MAIN
      EQUIVALENCE (XNSEG(589), ARTHEO)                                  MAIN
      EQUIVALENCE (XNSEG(590), WSLEFC)                                  MAIN
      EQUIVALENCE (XNSEG(591), CLATOT)                                  MAIN
      EQUIVALENCE (XNSEG(592), CL0   )                                  MAIN
      EQUIVALENCE (XNSEG(593), TRATIO)                                  MAIN
      EQUIVALENCE (XNSEG(594), DFK   )                                  MAIN
      EQUIVALENCE (XNSEG(595), GRNDFT)                                  MAIN
      EQUIVALENCE (XNSEG(596), CD0   )                                  MAIN
      EQUIVALENCE (XNSEG(599), BFOBEX)                                  MAIN
      EQUIVALENCE (XNSEG(600), FLAPDT)                                  MAIN
      EQUIVALENCE (XNSEG(601), CFOCAV)                                  MAIN
      EQUIVALENCE (XNSEG(605), W0    )                                  MAIN
      EQUIVALENCE (XNSEG(606), FN0   )                                  MAIN
      EQUIVALENCE (XNSEG(607), XIS0  )                                  MAIN
      EQUIVALENCE (XNSEG(608), V50   )                                  MAIN
      EQUIVALENCE (XNSEG(609), W50   )                                  MAIN
      EQUIVALENCE (XNSEG(624), T50   )                                  MAIN
      EQUIVALENCE (XNSEG(625), VSTAL )                                  MAIN
      EQUIVALENCE (XNSEG(626), GAM50 )                                  MAIN
      EQUIVALENCE (XNSEG(627), XAIR  )                                  MAIN
      EQUIVALENCE (XNSEG(628), XG    )                                  MAIN
      EQUIVALENCE (XNSEG(629), X50   )                                  MAIN
      EQUIVALENCE  (XNSEG(757),INDTOA),(XNSEG(758),CLMAX)               MAIN
      EQUIVALENCE    (XNSEG(759),AWMAX)                                 MAIN
      XIS0 = FN0*3600.0/FFR                                             MAIN
      CALL PAGHED                                                       MAIN
      FLAPDE = FLAPDT                                                   MAIN
      GRNDFC = GRNDFT                                                   MAIN
      IF(INDTOA.NE.0)  GO TO 100                                        MAIN
C     TAKE-OFF CL-MAX AND ALPHA FOR CL-MAX NOT READ IN.                 MAIN
      CALL TLAERO(TRATIO, ARTHEO, WSLEFC, CLMAXB, ACLMAX, DCLMAX)       MAIN
      CLMAX = CLMAXB + DCLMAX                                           MAIN
      AWMAX = ACLMAX * 0.80                                             MAIN
  100 CONTINUE                                                          MAIN
      AMAX = AWMAX - WINCID                                             MAIN
      DELCLF = 10.95 * CLATOT * (1.5 * BFOBEX - 0.50 * BFOBEX**2) * SQRTMAIN
     1(CFOCAV) * (0.0625 * FLAPDE - 0.000472 * FLAPDE**2)               MAIN
      CLMAXF = CLMAX + DELCLF                                           MAIN
      W0OS = W0 / SREF                                                  MAIN
      VSTAL = 17.16 * SQRT(W0OS / CLMAXF)                               MAIN
      AU = AMAXG - 1.0                                                  MAIN
      AWU = AU + WINCID                                                 MAIN
      CLU = 57.29 * CLATOT * SIN(AWU/57.29) * COS(AWU/57.29)**2 +       MAIN
     1(CLMAX / COS(AWMAX/57.29) - 28.645 * CLATOT * SIN(AWMAX/28.645))  MAIN
     2* SIN(AWU/57.29)**2 * COS(AWU/57.29) / SIN(AWMAX/57.29)**2        MAIN
      CLUF = CLU + DELCLF                                               MAIN
      IF(CLUF.LE.0.826*CLMAXF) GO TO 10                                 MAIN
      CLUF = 0.826 * CLMAXF                                             MAIN
      CLU = CLUF - DELCLF                                               MAIN
      AU = CLU * AWMAX / CLMAX - WINCID                                 MAIN
   10 VU = 17.16 * SQRT(W0OS / CLUF)                                    MAIN
      V50 = 1.1 * VU                                                    MAIN
      CL50 = 0.826 * CLUF                                               MAIN
      CDLG = CDPLG * SPLG / SREF                                        MAIN
      CD50 = CD0 + DFK * CL50 * (CL50 - CL0 - DELCLF) + CDLG            MAIN
      CDU = CD0 + DFK * CLUF * (CLUF - CL0 - DELCLF) + CDLG             MAIN
      CDAV = (CD50 +CDU) / 2.0                                          MAIN
      XAIR = (50.0 + 2.745 * W0OS / CLUF) / (FN0 / W0 - 1.105 * CDAV    MAIN
     1/ CLUF )                                                          MAIN
      AWG = AG + WINCID                                                 MAIN
      CLG = 57.29 * CLATOT * SIN(AWG/57.29) * COS(AWG/57.29)**2 +       MAIN
     1(CLMAX / COS(AWMAX/57.29) - 28.645 * CLATOT * SIN(AWMAX/28.645))  MAIN
     2* SIN(AWG/57.29)**2 * COS(AWG/57.29) / SIN(AWMAX/57.29)**2        MAIN
      CDG = CD0 + DFK * CLG * (CLG - CL0 - DELCLF) + CDLG               MAIN
      XG = 13.07 * W0OS / (CLUF * (FN0/W0 - GRNDFC - 0.5 * (CDG -       MAIN
     1GRNDFC * CLG) / CLUF))                                            MAIN
      X50 = XG + XAIR                                                   MAIN
      TG = 1.1842 * XG / VU                                             MAIN
      T50 = TG + XAIR / (1.6889 * VU)                                   MAIN
      DELW = FN0 * T50 / XIS0                                           MAIN
      W50 = W0 - DELW                                                   MAIN
      SGAM50 = FN0/W50 - CD50/CL50                                      MAIN
      ROC = 1.6889 * V50 * SGAM50                                       MAIN
      IF(SGAM50 .GT. 1.0) SGAM50 = 1.0                                  MAIN
      GAM50 =   ASIN(SGAM50)                                            MAIN
      GAM50 = GAM50 * 57.29                                             MAIN
      WRITE(6,21) CLMAX, CLMAXF, DELCLF, CLU, CLUF, CLG, CL50, CDG      MAIN
   21 FORMAT(1H0, 20X, 32HOUTPUT FROM TAKEOFF CALCULATIONS,             MAIN
     2/57H MAXIMUM WING LIFT COEFFICIENT                    CLMAX =G15.7MAIN
     3/57H MAXIMUM WING PLUS FLAP LIFT COEFFICIENT          CLMAXF=G15.7MAIN
     4/57H FLAP LIFT COEFFICIENT INCREMENT                  DELCLF=G15.7MAIN
     5/57H GROUND ROTATION WING LIFT COEFFICIENT            CLU   =G15.7MAIN
     6/57H GROUND ROTATION WING PLUS FLAP LIFT COEFFICIENT  CLUF  =G15.7MAIN
     7/57H GROUND ROLL LIFT COEFIICIENT                     CLG   =G15.7MAIN
     8/57H LIFT COEFFICIENT AT OBSTACLE                     CL50  =G15.7MAIN
     9/57H GROUND ROLL DRAG COEFIICIENT                     CDG   =G15.7MAIN
     *)                                                                 MAIN
      WRITE (6,22)                                                      MAIN
     1CDU, CD50, AU, AWMAX, VSTAL, VU, V50, XG, X50, TG, T50, DELW,     MAIN
     2W50, ROC, GAM50                                                   MAIN
   22 FORMAT(                                                           MAIN
     * 57H GROUND ROTATION DRAG COEFFICIENT                 CDU   =G15.7MAIN
     1/57H DRAG COEFFICIENT AT OBSTACLE                     CD50  =G15.7MAIN
     2/57H GROUND ROTATION BODY ANGLE (DEG)                 AU    =G15.7MAIN
     3/57H ANG. OF ATTACK FOR MAXIMUM LIFT COEFF (DEG)      AWMAX =G15.7MAIN
     4/57H POWER OFF STALL SPEED (KNOTS)                    VSTAL =G15.7MAIN
     5/57H FLIGHT SPEED CORRESPONDING TO CLUF (KNOTS)       VU    =G15.7MAIN
     6/57H FLIGHT SPEED AT OBSTACLE (KNOTS)                 V50   =G15.7MAIN
     7/57H GROUND ROLL DISTANCE (FT)                        XG    =G15.7MAIN
     8/57H TAKE-OFF DISTANCE OVER OBSTACLE (FT)             X50   =G15.7MAIN
     9/57H GROUND ROLL TIME (SEC)                           TG    =G15.7MAIN
     */57H TAKE-OFF TIME (SEC)                              T50   =G15.7MAIN
     2/57H FUEL USED FOR TAKE-OFF (LB)                      DELW  =G15.7MAIN
     3/57H WEIGHT AT OBSTACLE (LB)                          W50   =G15.7MAIN
     4/57H RATE OF CLIMB AT OBSTACLE (FPS)                  ROC   =G15.7MAIN
     5/57H FLIGHT PATH ANGLE AT OBSTACLE (DEG)              GAM50 =G15.7MAIN
     *)                                                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE OPTX14(TZ, RG)                                         MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
      REAL TZ(1)                                                        MAIN
      REAL RG(1)                                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 72), AM    )                                  MAIN
      EQUIVALENCE (XNSEG( 76), AME   )                                  MAIN
      EQUIVALENCE (XNSEG( 79), CL    )                                  MAIN
      EQUIVALENCE (XNSEG( 82), CLZZ  )                                  MAIN
      EQUIVALENCE (XNSEG( 83), CLC   )                                  MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(109), QS    )                                  MAIN
      EQUIVALENCE (XNSEG(110), RC    )                                  MAIN
      EQUIVALENCE (XNSEG(124), WT    )                                  MAIN
      EQUIVALENCE (XNSEG(127), XQSW  )                                  MAIN
      EQUIVALENCE (XNSEG(128), XAA   )                                  MAIN
      EQUIVALENCE (XNSEG(133), XB0   )                                  MAIN
      EQUIVALENCE (XNSEG(134), XB1   )                                  MAIN
      EQUIVALENCE (XNSEG(140), XQBD  )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      EQUIVALENCE (XNSEG(198), AMLIM )                                  MAIN
      EQUIVALENCE (XNSEG(199), QLIM  )                                  MAIN
      EQUIVALENCE (XNSEG(231), WTKEP )                                  MAIN
      EQUIVALENCE (XNSEG(237), ITZ   )                                  MAIN
      EQUIVALENCE(XNSEG(348),RETWGT)                                    MAIN
      EQUIVALENCE (XNSEG(362), XQ12  )                                  MAIN
      EQUIVALENCE (XNSEG(623), GLEVEL)                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(8),Q)                                          MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C     OPTION 14 DETERMINE SEGMENT END POINTS                            MAIN
C  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..   MAIN
C***  SUB OPTIONS DEFINED BY VALUE IN TZ(5)                             MAIN
C     1 NO CHANGE IN VALUES OF AM,H,OR WT ON RETURN                     MAIN
C     2 READ IN NEW VALUES OF AM,H,AND WT                               MAIN
C     3 RESTORE AM,H,AND WT TO VALUES AT END OF SPECIFED SEG            MAIN
C***  SUB OPTIONS USED TO DEFINE END POINTS FOR USE WITH OPTION10       MAIN
C     VALUES SET BY TZ(7)                                               MAIN
C     1 FIND BEST RANGE ALTITUDE FOR GIVEN WT AND MACH                  MAIN
C     2 FIND R/C=XXXFT/MIN H FOR GIVEN WT AND MACH                      MAIN
C     3 FIND MACH FOR GIVEN H WT AT CL=CL(OPT)                          MAIN
C     4 FIND MACH FOR GIVEN H WT AT GIVEN CL                            MAIN
C     5 FIND MACH FOR MAX. ENDURANCE GIVEN WT. AND ALT.                 MAIN
C     6 FIND MAX. MACH GIVEN WT. AND ALT.                               MAIN
C     7 FIND MACH FOR MAX RATE OF CLIMB                                 MAIN
C     8 FIND MACH AND ALT. FOR MAX RANGE FACTOR                         MAIN
C     9 FIND MACH FOR MAX RANGE FACTOR WITH INPUTED ALT.                MAIN
C***  NOTE  CALCULATED VALUES OF H OR MACH WILL NOT BE                  MAIN
C     RETAINED AT END OF OPTION 14   THE VALUES BE STORED               MAIN
C     IN THE RG(ARRAY) AND WHEN USED AS END POINTS FOR                  MAIN
C     SEGMENT CALCULATIONS OPTION 10 SHOULD BE USED                     MAIN
      WTKEP=WT                                                          MAIN
      N14A=TZ(ITZ+4)+.1                                                 MAIN
      GO TO (1, 2, 3), N14A                                             MAIN
C              .......                                                  MAIN
    1 CONTINUE                                                          MAIN
C     14A    1.                                                         MAIN
C              USE THE MACH, ALTITUDE AND WEIGHT AVAILABLE              MAIN
C              FROM THE COMPLETION OF THE PREVIOUS                      MAIN
C              SEGMENT AND CONTINUE WITH 14B                            MAIN
      GO TO 100                                                         MAIN
C              .......                                                  MAIN
    2 CONTINUE                                                          MAIN
C     14A    2.                                                         MAIN
C              GIVEN MACH, ALTITUDE AND WEIGHT                          MAIN
C              FROM TERMS 1, 2, AND 3 CONTINUE WITH 14B                 MAIN
      AM=TZ(ITZ)                                                        MAIN
      H=TZ(ITZ+1)                                                       MAIN
      WT=TZ(ITZ+2)                                                      MAIN
      IF(WT.LE.0.0001) WT= RETWGT                                       MAIN
      WTKEP=WT                                                          MAIN
      GO TO 100                                                         MAIN
C              .......                                                  MAIN
    3 CONTINUE                                                          MAIN
C     14A    3.                                                         MAIN
C              RESTORE THE AIRCRAFT TO THE MACH, ALTITUDE               MAIN
C              AND WEIGHT CONDITION AT THE END OF THE SEGMENT           MAIN
C              SPECIFIED BY TERM 4 AND GO TO NEXT SEGMENT               MAIN
C              IGNORE THE 14B SUBOPTION                                 MAIN
      NTZ=TZ(ITZ+3)*10.0-9.0                                            MAIN
      AM=RG(NTZ+2)                                                      MAIN
      H=RG(NTZ+1)                                                       MAIN
      WT=RG(NTZ)                                                        MAIN
      WTKEP=WT                                                          MAIN
      RETURN                                                            MAIN
C     ........                                                          MAIN
  100 CONTINUE                                                          MAIN
      N14B=TZ(ITZ+6)+.1                                                 MAIN
      GO TO (101,102,103,104,105,106,107,108,109,110), N14B             MAIN
C     .....                                                             MAIN
  101 CONTINUE                                                          MAIN
C        1.    BEST CRUISE ALTITUDE FOR THE MACH AND WEIGHT SPECIFIED   MAIN
      RC=TZ(8)                                                          MAIN
      CALLBERAN                                                         MAIN
      CLCC=CLC                                                          MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  102 CONTINUE                                                          MAIN
C        2.    RATE OF CLIMB CELING FOR MACH, WEIGHT                    MAIN
C              AND RATE OF CLIMB SPECIFIED                              MAIN
      RC=TZ(ITZ+3)                                                      MAIN
      CALLTOP                                                           MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  103 CONTINUE                                                          MAIN
C        3.    MACH FOR OPTIMUM LIFT COEFFICIENT (BEST LIFT             MAIN
C              TO DRAG RATIO) AT THE WEIGHT AND ALITTUDE SPECIFIED      MAIN
      CALL ALTA                                                         MAIN
      QS=Q*XQSW                                                         MAIN
      CL=WT/QS                                                          MAIN
      CALLDRAG                                                          MAIN
      CLC = XQ12                                                        MAIN
      XQBD=7.1                                                          MAIN
      CALLCHECK                                                         MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  104 CONTINUE                                                          MAIN
C        4.    MACH FOR THE SPECIFIED WEIGHT, ALTITUDE                  MAIN
C              AND LIFT COEFFICIENT                                     MAIN
      CALL ALTA                                                         MAIN
      CLC=TZ(ITZ+3)                                                     MAIN
      XQBD=7.1                                                          MAIN
      CALLCHECK                                                         MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  105 CONTINUE                                                          MAIN
C        5.    MAXIMUM ENDURANCE MACH FOR THE SPECIFIED                 MAIN
C              WEIGHT, ALTITUDE AND MAXIMUM LIFT COEFFICIENT            MAIN
      CLZZ=TZ(ITZ+3)                                                    MAIN
      XB0=QLIM                                                          MAIN
      XB1=AMLIM                                                         MAIN
      CALLEMAX                                                          MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  106 CONTINUE                                                          MAIN
C        6.    MAXIMUM MACH ATTAINABLE AT THE SPECIFIED                 MAIN
C              WEIGHT AND ALTITUDE                                      MAIN
      CLZZ=1.2                                                          MAIN
      CALLVMAX                                                          MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  107 CONTINUE                                                          MAIN
C        7.    MACH NUMBER FOR THE MAXIMUM RATE OF CLIMB                MAIN
C              AT THE SPECIFIED WEIGHT AND ALTITUDE                     MAIN
      XB0=QLIM                                                          MAIN
      XB1=AMLIM                                                         MAIN
C XAA TERM ADDED JAN., 1970 BY G.F.Q.                                   MAIN
C     XAA=0.0 DETERMINE MACH FOR MAX. RATE OF CLIMB                     MAIN
C     XAA=1.0 DETERMINE MACH FOR MAX. DH/DW                             MAIN
      XAA=TZ(ITZ+3)                                                     MAIN
      CALLCMAX                                                          MAIN
      AM=AME                                                            MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  108 CONTINUE                                                          MAIN
C        8.    MACH AND ALTITUDE FOR MAXUMUM RANGE FACTOR               MAIN
C              AT THE SPECIFIED WEIGHT                                  MAIN
      XB1=AMLIM                                                         MAIN
      RC=TZ(8)                                                          MAIN
      XQBD=0.0                                                          MAIN
      IF(TZ(ITZ+3).GT.0.05)XB1=TZ(ITZ+3)                                MAIN
      CALLRFMAX                                                         MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  109 CONTINUE                                                          MAIN
C        9.    MACH FOR MAXIMUM RANGE FACTOR AT THE SPECIFIED           MAIN
C              ALTITUDE AND WEIGHT                                      MAIN
      XB1=AMLIM                                                         MAIN
      IF(TZ(ITZ+3).GT.0.05)XB1=TZ(ITZ+3)                                MAIN
      XQBD=1.0                                                          MAIN
      CALL ATMOSD                                                       MAIN
      CALL RFMAX                                                        MAIN
      RETURN                                                            MAIN
C     .....                                                             MAIN
  110 CONTINUE                                                          MAIN
C       10.    THE VARIOUS ENERGY MANEUVERABILITY                       MAIN
C              PARAMETERS AT THE SPECIFIED G LEVEL,                     MAIN
C              MACH, WEIGHT AND ALTITUDE                                MAIN
      GLEVEL = TZ(ITZ+3)                                                MAIN
      CALL ENERGY                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE RPOLY(IDEGRE,COEFF,ROOT,IERR)                          MAIN
C                                                                       MAIN
C***********************************************************************MAIN
C                                                                    *  MAIN
C  PURPOSE                                                           *  MAIN
C                                                                    *  MAIN
C     SUBROUTINE RLPOLY COMPUTES THE ROOTS OF A POLYNOMIAL WITH      *  MAIN
C     REAL COEFFICIENTS USING A THREE-STAGE VARIABLE-SHIFT ITERATION *  MAIN
C     TECHNIQUE. THE PROGRAM FINDS THE ROOTS ONE OR TWO AT A TIME    *  MAIN
C     IN ROUGHLY INCREASING ORDER OF MODULUS AND DEFLATES THE        *  MAIN
C     POLYNOMIAL TO ONE OF LOWER DEGREE. THIS PROGRAM IS BASED ON THE*  MAIN
C     ALGORITHM PUBLISHED BY M.A. JENKINS AND J.F. TRAUB IN  SIAM    *  MAIN
C     JOURNAL OF NUMERICAL ANALYSIS, VOL. 7, NO. 2, DECEMBER 1970.   *  MAIN
C     THIS PROGRAM IS A CONDENSED AND STREAMLINED VERSION OF A       *  MAIN
C     FORTRAN PROGRAM SUPPLIED BY M.A. JENKINS TO NASA LANGLEY       *  MAIN
C     RESEARCH CENTER.                                               *  MAIN
C                                                                    *  MAIN
C  USE                                                               *  MAIN
C                                                                    *  MAIN
C     CALL RPOLY(IDEGRE,COEFF,ROOT,IERR)                             *  MAIN
C                                                                    *  MAIN
C  PARAMETERS                                                        *  MAIN
C                                                                    *  MAIN
C     IDEGRE--INPUT/OUTPUT INTEGER.                                  *  MAIN
C                                                                    *  MAIN
C             INPUT-THE DEGREE OF THE POLYNOMIAL.  1'IDEGRE'49       *  MAIN
C                                                                    *  MAIN
C             OUTPUT-THE NUMBER OF ROOTS OF THE POLYNOMIAL WHICH     *  MAIN
C             RPOLY CALCULATED.                                      *  MAIN
C                                                                    *  MAIN
C     COEFF---INPUT REAL ONE DIMENSIONAL ARRAY OF COEFFICIENTS IN    *  MAIN
C             ORDER OF DECREASING POWERS.                            *  MAIN
C             COEFF(1)*X**N +COEFF(2)*X**(N-1) + ...                 *  MAIN
C             DIMENSIONED IDEGRE+1. THE ARRAY IS DESTROYED BY RPOLY. *  MAIN
C                                                                    *  MAIN
C     ROOT----OUTPUT COMPLEX ONE DIMENSIONAL ARRAY OF COMPUTED ROOTS *  MAIN
C             OF THE POLYNOMIAL.  DIMENSIONED IDEGRE.                *  MAIN
C                                                                    *  MAIN
C     IERR----OUTPUT INTEGER ERROR CODE.                             *  MAIN
C                                                                    *  MAIN
C             = 0 IF IDEGRE ROOTS WERE CALCULATED (NORMAL RETURN)    *  MAIN
C                                                                    *  MAIN
C             = -1 IF LESS THAN IDEGRE ROOTS WERE CALCUATED.  THE    *  MAIN
C              ROOTS WHICH WERE CALCULATED ARE AVAILABLE IN ARRAY    *  MAIN
C              ROOT.  IDEGRE IS RESET TO THE NUMBER OF ROOTS FOUND.  *  MAIN
C                                                                    *  MAIN
C             = -2 COEFF(1)=0.                                       *  MAIN
C                                                                    *  MAIN
C             THE USER SHOULD TEST OR WRITE OUT IERR ON RETURN FROM  *  MAIN
C             RPOLY.                                                 *  MAIN
C                                                                    *  MAIN
C  REQUIRED ROUTINES                                                 *  MAIN
C                                                                    *  MAIN
C     CALCSC, NEXTK, NEWEST, QUADSD, QUAD.                           *  MAIN
C                                                                    *  MAIN
C  AUTHOR/IMPLEMENTER                                                *  MAIN
C                                                                    *  MAIN
C     S. BAUDENDISTEL/G.W. HAIGLER                                   *  MAIN
C                                                                    *  MAIN
C  LANGUAGE                                                          *  MAIN
C                                                                    *  MAIN
C     FORTRAN                                                        *  MAIN
C                                                                    *  MAIN
C  DATE RELEASED                                                     *  MAIN
C                                                                    *  MAIN
C     APRIL 27, 1973                                                 *  MAIN
C                                                                    *  MAIN
C  LATEST REVISION                                                   *  MAIN
C                                                                    *  MAIN
C     SEPTEMBER 24, 1973                                             *  MAIN
C                                                                    *  MAIN
C***********************************************************************MAIN
C                                                                       MAIN
C***********************************************************************MAIN
C                                                                       MAIN
C TO CHANGE THE MAXIMUM ORDER POLYNOMIAL WHICH CAN BE SOLVED REQUIRES   MAIN
C ONLY CHANGING ALL ARRAY BOUNDS OTHER THAN COEFF AND ROOT BY THE SAME  MAIN
C AMOUNT                                                                MAIN
C                                                                       MAIN
C***********************************************************************MAIN
C                                                                       MAIN
C MACHINE CONSTANTS                                                     MAIN
C                                                                       MAIN
C THERE ARE SEVERAL CONSTANTS USED WHICH ARE BASED ON THE COMPUTER USED MAIN
C THESE CONSTANTS ARE BASED ON THE FOLLOWING FORMULAE FOR CDC 6000      MAIN
C SERIES                                                                MAIN
C                                                                       MAIN
C BASE   - BASE OF FLOATING-POINT NUMBER SYSTEM USED                    MAIN
C          = 2                                                          MAIN
C                                                                       MAIN
C T      - NUMBER OF BASE-DIGITS IN EACH FLOATING-POINT NUMBER          MAIN
C          = 48                                                         MAIN
C                                                                       MAIN
C L      - LARGEST EXPONENT ALLOWABLE IN THE NUMBER SYSTEM USED         MAIN
C          = 1069                                                       MAIN
C                                                                       MAIN
C S      - SMALLEST EXPONENT ALLOWABLE IN THE NUMBER SYSTEM USED        MAIN
C          = -976                                                       MAIN
C                                                                       MAIN
C ETA    - THE MAXIMUM RELATIVE REPRESENTATION ERROR                    MAIN
C          THE SMALLEST POSITIVE FLOATING-POINT NUMBER SUCH THAT        MAIN
C          1.0 + ETA .GT. 1.0                                           MAIN
C          = .5*BASE**(1-T) IF COMPUTER ROUNDS                          MAIN
C          = BASE**(1-T) IF COMPUTER TRUNCATES (CDC 6000)               MAIN
C          = 7.10542735760100E-15                                       MAIN
C                                                                       MAIN
C RINFIN - THE LARGEST FLOATING-POINT NUMBER ALLOWED BY THE MACHINE     MAIN
C          = BASE*(1-BASE**(-T))*BASE**(L-1)                            MAIN
C          = 6.32507041585343E+321                                      MAIN
C                                                                       MAIN
C HI     - UPPER BOUND USED TO DETERMINE IF SCALING IS NECESSARY        MAIN
C          = SQRT(RINFIN)                                               MAIN
C          = 7.953031130237975E+160                                     MAIN
C                                                                       MAIN
C CONSTL - LOWER BOUND USED TO DETERMINE IF SCALING IS NECESSARY        MAIN
C          = BASE**S/ETA                                                MAIN
C          = 4.407212831701244E-280                                     MAIN
C                                                                       MAIN
C BASELN - LOGARITHM OF THE BASE                                        MAIN
C          = ALOG(BASE)                                                 MAIN
C          = 6.93147180559945E-01                                       MAIN
C                                                                       MAIN
C ARE    - MAXIMUM RELATIVE ROUNDOFF ERROR FOR FLOATING-POINT ADDITION  MAIN
C          = ETA (CDC 6000) (IBM 360)                                   MAIN
C                                                                       MAIN
C ERM    - MAXIMUM RELATIVE ROUNDOFF ERROR FOR FLOATING-POINT MULT.     MAIN
C          = ETA (CDC 6000) (IBM 360)                                   MAIN
C                                                                       MAIN
C W1,W2,   VARIOUS ERRORS IN EVALUATING POLYNOMIALS BY HORNERS RECURRENCMAIN
C W3,W4,   W1,W2 FOR LINEAR EVALUATION                                  MAIN
C W5       W3,W4,W5 FOR QUADRATIC EVALUATION                            MAIN
C                                                                       MAIN
C W1     - ERM = ETA                                                    MAIN
C                                                                       MAIN
C W2     - ERM + ARE                                                    MAIN
C          = 1.421085471520200E-14                                      MAIN
C                                                                       MAIN
C W3     - 5 * ERM + 4 * ARE                                            MAIN
C          = 6.394884621840902E-14                                      MAIN
C                                                                       MAIN
C W4     - 5 * ERM + 2 * ARE                                            MAIN
C          = 4.973799150320701E-14                                      MAIN
C                                                                       MAIN
C W5     - 2 * ERM                                                      MAIN
C          = W2 (CDC 6000) (IBM 360)                                    MAIN
C                                                                       MAIN
C***********************************************************************MAIN
C                                                                       MAIN
      COMMON/GLOBAL/QP,K,QK,U,V,A,B,C,D,E,F,G,H,A1,A3,A7,ITYPE,ETA,NM1, MAIN
     $              N,NN,UI,VI                                          MAIN
C                                                                       MAIN
      DIMENSION PT(050),ROOT(1),QP(050),K(049),QK(049),SVK(049),        MAIN
     $          TEMP(049),COEFF(1)                                      MAIN
      COMPLEX ROOT                                                      MAIN
      LOGICAL TRIED,SPASS,STRY,VPASS,VTRY                               MAIN
      REAL K                                                            MAIN
      EQUIVALENCE (ETA,ARE,W1),(W2,W5)                                  MAIN
C                                                                       MAIN
      DATA XX,YY,BASELN/.70710678,-.70710678,6.93147180559945E-01/      MAIN
      DATA ETA,RINFIN/7.105427357601001E-15,6.32507041585343E+321/      MAIN
      DATA HI,CONSTL/7.953031130237975E+160,4.407212831701244E-280/     MAIN
      DATA W2/1.421085471520200E-14/                                    MAIN
      DATA W3,W4/6.394884621840902E-14,4.973799150320701E-14/           MAIN
C                                                                       MAIN
      IERR=0                                                            MAIN
      N=IDEGRE                                                          MAIN
      NN=N+1                                                            MAIN
C                                                                       MAIN
C ALGORITH FAILS IF THE LEADING COEFFICIENT IS ZERO OR FEWER THAN IDEGREMAIN
C ROOTS FOUND IN WHICH CASE IDEGRE IS RESET TO THE NUMBER OF ROOTS      MAIN
C FOUND                                                                 MAIN
C                                                                       MAIN
      IF(COEFF(1).NE.0.)GOTO 10                                         MAIN
      IERR=-1                                                           MAIN
    5 IERR=IERR-1                                                       MAIN
      IDEGRE=IDEGRE-N                                                   MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
C REMOVE THE ROOTS AT ORIGIN IF ANY                                     MAIN
C                                                                       MAIN
   10 IF(COEFF(NN).NE.0.)GOTO 15                                        MAIN
      J=IDEGRE-N+1                                                      MAIN
      ROOT(J)=(0.,0.)                                                   MAIN
      NN=NN-1                                                           MAIN
      N=N-1                                                             MAIN
      GOTO 10                                                           MAIN
C                                                                       MAIN
C MAKE A TEMPORARY WORK COPY OF THE COEFFICIENTS                        MAIN
C                                                                       MAIN
   15 DO 20 I=1,NN                                                      MAIN
   20 PT(I)=ABS(COEFF(I))                                               MAIN
C                                                                       MAIN
C SECTION SCALE ********************************************************MAIN
C                                                                       MAIN
C  COMPUTES A SCALE FACTOR AA=BASE**I TO MULTIPLY THE COEFFICIENTS OF   MAIN
C  THE POLYNOMIAL. THE SCALING IS DONE TO AVOID OVERFLOW AND TO AVOID   MAIN
C  UNDETECTED UNDERFLOW INTERFERING WITH THE CONVERGENCE CRITERION.     MAIN
C  FIND THE LARGEST AND SMALLEST MODULI OF THE COEFFICIENTS             MAIN
C  SCALE ONLY IF THERE ARE VERY LARGE OR VERY SMALL COEFFICIENTS        MAIN
C                                                                       MAIN
      X=0.                                                              MAIN
      XM=RINFIN                                                         MAIN
      DO 25 I=1,NN                                                      MAIN
      FF=PT(I)                                                          MAIN
      IF(FF.GT.X)X=FF                                                   MAIN
      IF(FF.NE.0..AND.FF.LT.XM)XM=FF                                    MAIN
   25 CONTINUE                                                          MAIN
      IF(XM.GE.CONSTL.AND.X.LE.HI)GOTO 55                               MAIN
      FF=CONSTL/XM                                                      MAIN
      IF(FF.GT.1.)GOTO 30                                               MAIN
      DF=1./SQRT(X*XM)                                                  MAIN
      GOTO 35                                                           MAIN
   30 DF=FF                                                             MAIN
      IF(RINFIN/DF.GT.X)GOTO 55                                         MAIN
   35 I=ALOG(DF)/BASELN                                                 MAIN
      IF(I.EQ.0)GOTO 55                                                 MAIN
C                                                                       MAIN
C  THE FOLLOWING SECTION CALCULATES 2**I TAKING ADVANTAGE OF BASE=2     MAIN
C  IF BASE.NE.2 THIS CODING SHOULD BE REPLACED BY CODING WHICH GENERATESMAIN
C  BASE**I=AA(THE SCALING FACTOR)                                       MAIN
C                                                                       MAIN
      JJ=I                                                              MAIN
      IF(I.LT.0)I=-I                                                    MAIN
      AA=2.                                                             MAIN
      J=2                                                               MAIN
   40 IF(J.GT.I)GOTO 45                                                 MAIN
      AA=AA+AA                                                          MAIN
      J=J+1                                                             MAIN
      GOTO 40                                                           MAIN
   45 IF(JJ.LT.0)AA=1./AA                                               MAIN
C                                                                       MAIN
      DO 50 I=1,NN                                                      MAIN
   50 COEFF(I)=AA*COEFF(I)                                              MAIN
C                                                                       MAIN
C******************** END SECTION SCALE ********************************MAIN
C                                                                       MAIN
C START THE ALGORITHM FOR ONE ROOT-TRANSFER TO A STARTING POINT DEPENDINMAIN
C ON THE DEGREE OF THE POLYNOMIAL                                       MAIN
C                                                                       MAIN
   55 IF(N.GT.2)GOTO 65                                                 MAIN
      IF(N.LT.1)RETURN                                                  MAIN
C                                                                       MAIN
C CALCULATE THE FINAL ROOT OR PAIR OF ROOTS                             MAIN
C                                                                       MAIN
      IF(N.EQ.2)GOTO 60                                                 MAIN
      ROOT(IDEGRE)=CMPLX(-COEFF(2)/COEFF(1),0.)                         MAIN
      RETURN                                                            MAIN
   60 NNM1=IDEGRE-1                                                     MAIN
      CALL QUAD(COEFF(1),COEFF(2)/2.,COEFF(3),SZR,SZI,ZLR,ZLI)          MAIN
      ROOT(NNM1)=CMPLX(SZR,SZI)                                         MAIN
      ROOT(IDEGRE)=CMPLX(ZLR,ZLI)                                       MAIN
      RETURN                                                            MAIN
   65 DO 70 I=1,NN                                                      MAIN
   70 PT(I)=ABS(COEFF(I))                                               MAIN
C                                                                       MAIN
C SECTION CAUCHY *******************************************************MAIN
C                                                                       MAIN
C  COMPUTES LOWER BOUND ON MODULI OF ROOTS--X                           MAIN
C                                                                       MAIN
      PT(NN)=-PT(NN)                                                    MAIN
C                                                                       MAIN
C  COMPUTE UPPER ESTIMATE OF BOUND                                      MAIN
C                                                                       MAIN
      X=EXP(ALOG(-PT(NN)/PT(1))/FLOAT(N))                               MAIN
      IF(PT(N).EQ.0.0)GOTO 75                                           MAIN
C                                                                       MAIN
C  IF NEWTON STEP AT ORIGIN IS BETTER USE IT                            MAIN
C                                                                       MAIN
      XM=-PT(NN)/PT(N)                                                  MAIN
      IF(XM.LT.X)X=XM                                                   MAIN
C                                                                       MAIN
C  CHOP INTERVAL (0,X) UNTIL  FF.LE.0                                   MAIN
C                                                                       MAIN
   75 XM=.1*X                                                           MAIN
      FF=PT(1)                                                          MAIN
      DO 80 I=2,NN                                                      MAIN
   80 FF=FF*XM+PT(I)                                                    MAIN
      IF(FF.LE.0.0)GOTO 85                                              MAIN
      X=XM                                                              MAIN
      GOTO 75                                                           MAIN
   85 DX=X                                                              MAIN
C                                                                       MAIN
C  DO NEWTON ITERATION UNTIL X CONVERGES TO TWO DECIMAL PLACES          MAIN
C                                                                       MAIN
   90 IF(ABS(DX/X).LE.0.005)GOTO 100                                    MAIN
      FF=PT(1)                                                          MAIN
      DF=FF                                                             MAIN
      DO 95 I=2,N                                                       MAIN
      FF=FF*X+PT(I)                                                     MAIN
   95 DF=DF*X+FF                                                        MAIN
      FF=FF*X+PT(NN)                                                    MAIN
      DX=FF/DF                                                          MAIN
      X=X-DX                                                            MAIN
      GOTO 90                                                           MAIN
C                                                                       MAIN
C******************** END SECTION CAUCHY *******************************MAIN
C                                                                       MAIN
C SECTION NOSHIFT ******************************************************MAIN
C                                                                       MAIN
C  PERFORMS 5 NOSHIFT STEPS                                             MAIN
C                                                                       MAIN
C  COMPUTE THE DERIVATIVE OF THE POLYNOMIAL AS THE INITIAL K POLYNOMIAL MAIN
C                                                                       MAIN
  100 NM1=N-1                                                           MAIN
      DX=1./FLOAT(NN)                                                   MAIN
      DO 105 I=1,N                                                      MAIN
  105 K(I)=COEFF(I)*(DX*FLOAT(NN-I))                                    MAIN
      AA=COEFF(NN)                                                      MAIN
      BB=ABS(COEFF(N))*ETA*10.                                          MAIN
      DO 125 JJ=1,5                                                     MAIN
      CC=K(N)                                                           MAIN
      IF(ABS(CC).LE.BB)GOTO 115                                         MAIN
      T=-AA/CC                                                          MAIN
      DO 110 I=1,NM1                                                    MAIN
      J=NN-I                                                            MAIN
  110 K(J)=T*K(J-1)+COEFF(J)                                            MAIN
      K(1)=COEFF(1)                                                     MAIN
      GOTO 125                                                          MAIN
  115 DO 120 I=1,NM1                                                    MAIN
      J=NN-I                                                            MAIN
  120 K(J)=K(J-1)                                                       MAIN
      K(1)=0.                                                           MAIN
  125 CONTINUE                                                          MAIN
C                                                                       MAIN
C******************** END SECTION NOSHIFT ******************************MAIN
C                                                                       MAIN
C SAVE K FOR RESTARTS WITH NEW SHIFTS                                   MAIN
C                                                                       MAIN
      DO 130 I=1,N                                                      MAIN
  130 TEMP(I)=K(I)                                                      MAIN
C                                                                       MAIN
C LOOP TO SELECT A QUADRATIC SHIFT                                      MAIN
C                                                                       MAIN
      DO 315 JJ=10,100,10                                               MAIN
C                                                                       MAIN
C THE QUADRATIC EQUATION Z**2 +  U*Z + V CORRESPONDS TO A DOUBLE SHIFT  MAIN
C TO A NON-REAL POINT AND ITS COMPLEX CONJUGATE. THE POINT  SR+I*SI     MAIN
C HAS AMPLITUDE ROTATED BY 94 DEGREES FROM THE PREVIOUS SHIFT XX,YY AND MAIN
C MODULUS X (INITIAL AMPLITUDE XX=.70710678 YY=-XX)                     MAIN
C                                                                       MAIN
      XXX=-.069756474*XX-.99756405*YY                                   MAIN
      YY=.99756405*XX-.06975647*YY                                      MAIN
      XX=XXX                                                            MAIN
      SR=X*XX                                                           MAIN
      SI=X*YY                                                           MAIN
      U=-(SR+SR)                                                        MAIN
      V=X                                                               MAIN
C                                                                       MAIN
C SECTION FIXSHIFT *****************************************************MAIN
C                                                                       MAIN
C  SECOND STAGE CALCULATIONS, FIXED QUADRATIC SHIFTS                    MAIN
C  COMPUTES UP TO JJ FIXED SHIFT K-POLYNOMIALS, TESTING FOR CONVERGENCE MAIN
C  IN THE LINER OR QUADRATIC CASE. INITIATES ONE OF THE VARIABLE SHIFT  MAIN
C  ITERATIONS (REALITERATION OR QUADRATICITERATION) AND RETURNS WITH THEMAIN
C  NUMBER OF ROOTS (NZ) FOUND                                           MAIN
C                                                                       MAIN
      NZ=0                                                              MAIN
      DX=.25                                                            MAIN
      DF=.25                                                            MAIN
      OSS=SR                                                            MAIN
      OVV=V                                                             MAIN
C                                                                       MAIN
C EVALUATE POLYNOMIAL BY SYNTHETIC DIVISION                             MAIN
C                                                                       MAIN
      CALL QUADSD(NN,COEFF,QP,A,B)                                      MAIN
      CALL CALCSC                                                       MAIN
      DO 260 J=1,JJ                                                     MAIN
C                                                                       MAIN
C CALCULATE NEXT K POLYNOMIAL AND ESTIMATE V                            MAIN
C                                                                       MAIN
      CALL NEXTK                                                        MAIN
      CALL CALCSC                                                       MAIN
      CALL NEWEST(COEFF(N),COEFF(NN))                                   MAIN
      VV=VI                                                             MAIN
C                                                                       MAIN
C ESTIMATE S                                                            MAIN
C                                                                       MAIN
      SS=0.0                                                            MAIN
      IF(K(N).NE.0.)SS=-COEFF(NN)/K(N)                                  MAIN
      TS=1.                                                             MAIN
      TV=1.                                                             MAIN
      IF(J.EQ.1.OR.ITYPE.EQ.3)GOTO 255                                  MAIN
C                                                                       MAIN
C COMPUTE RELATIVE MEASURES OF CONVERGENCE OF S AND V SEQUENCES         MAIN
C                                                                       MAIN
      IF(VV.NE.0.)TV=ABS((VV-OVV)/VV)                                   MAIN
      IF(SS.NE.0.)TS=ABS((SS-OSS)/SS)                                   MAIN
C                                                                       MAIN
C IF DECREASING, MULTIPLY TWO MOST RECENT CONVERGENCE MEASURES          MAIN
C                                                                       MAIN
      TVV=1.                                                            MAIN
      IF(TV.LT.OTV)TVV=TV*OTV                                           MAIN
      TSS=1.                                                            MAIN
      IF(TS.LT.OTS)TSS=TS*OTS                                           MAIN
C                                                                       MAIN
C COMPARE WITH CONVERGENCE CRITERIA                                     MAIN
C                                                                       MAIN
      VPASS=TVV.LT.DF                                                   MAIN
      SPASS=TSS.LT.DX                                                   MAIN
      IF(.NOT.(SPASS.OR.VPASS))GOTO 255                                 MAIN
C                                                                       MAIN
C AT LEAST ONE SEQUENCE HAS PASSED THE CONVERGENCE TEST                 MAIN
C STORE VARIABLES BEFORE ITERATING                                      MAIN
C                                                                       MAIN
      AA=U                                                              MAIN
      BB=V                                                              MAIN
      DO 135 I=1,N                                                      MAIN
  135 SVK(I)=K(I)                                                       MAIN
      S=SS                                                              MAIN
C                                                                       MAIN
C CHOOSE ITERATION ACCORDING TO THE FASTEST CONVERGING SEQUENCE         MAIN
C                                                                       MAIN
      VTRY=.FALSE.                                                      MAIN
      STRY=.FALSE.                                                      MAIN
      IF(SPASS.AND.((.NOT.VPASS).OR.TSS.LT.TVV))GOTO 180                MAIN
C                                                                       MAIN
C SECTION QUADRATICITERATION  ******************************************MAIN
C                                                                       MAIN
C  VARIABLE-SHIFT K-POLYNOMIAL ITERATION FOR A QUADRATIC FACTOR         MAIN
C  CONVERGES ONLY IF THE ROOTS ARE EQUIMODULAR OR NEARLY SO             MAIN
C  UI, VI - COEFFICIENTS OF THE STARTING QUADRATIC                      MAIN
C                                                                       MAIN
  140 NZ=0                                                              MAIN
      TRIED=.FALSE.                                                     MAIN
C                                                                       MAIN
C  BEGIN MAIN LOOP                                                      MAIN
C                                                                       MAIN
      IR=0                                                              MAIN
  145 U=UI                                                              MAIN
      V=VI                                                              MAIN
      CALL QUAD(1.,U/2.,V,SZR,SZI,ZLR,ZLI)                              MAIN
C                                                                       MAIN
C  RETURN IF ROOTS OF THE QUADRATIC ARE REAL AND NOT CLOSE TO MULTIPLE  MAIN
C  OR NEARLY EQUAL AND OF OPPOSITE SIGN                                 MAIN
C                                                                       MAIN
      IF(ABS(ABS(SZR)-ABS(ZLR)).GT..01*ABS(ZLR))GOTO 170                MAIN
C                                                                       MAIN
C  EVALUATE POLYNOMIAL BY QUADRATIC SYNTHETIC DIVISION                  MAIN
C                                                                       MAIN
      CALL QUADSD(NN,COEFF,QP,A,B)                                      MAIN
C                                                                       MAIN
C  COMPUTE A RIGOROUS BOUND ON THE ROUNDING ERROR IN EVALUATING P       MAIN
C                                                                       MAIN
      PM=ABS(A-SZR*B)+ABS(SZI*B)                                        MAIN
      XM=SQRT(ABS(V))                                                   MAIN
      FF=2.*ABS(QP(1))                                                  MAIN
      XXX=-SZR*B                                                        MAIN
      DO 150 I=2,N                                                      MAIN
  150 FF=FF*XM+ABS(QP(I))                                               MAIN
      FF=FF*XM+ABS(A+XXX)                                               MAIN
      FF=W3*FF-W4*(ABS(A+XXX)+ABS(B)*XM)+W5*ABS(XXX)                    MAIN
C                                                                       MAIN
C  ITERATION HAS CONVERGED SUFFICIENTLY IF THE POLYNOMIAL               MAIN
C  VALUE IS LESS THAN 20 TIMES THIS BOUND                               MAIN
C                                                                       MAIN
      IF(PM.GT.20.0*FF)GOTO 155                                         MAIN
      NZ=2                                                              MAIN
      GOTO 170                                                          MAIN
C                                                                       MAIN
C  STOP ITERATION AFTER 20 STEPS                                        MAIN
C                                                                       MAIN
  155 IR=IR+1                                                           MAIN
      IF(IR.GT.20)GOTO 170                                              MAIN
      IF(IR.LT.2)GOTO 165                                               MAIN
      IF(RELSTP.GT.1.E-2.OR.PM.LT.OMP.OR.TRIED)GOTO 165                 MAIN
C                                                                       MAIN
C  A CLUSTER APPEARS TO BE STALLING THE CONVERGENCE. FIVE               MAIN
C  FIXED SHIFT STEPS ARE TAKEN WITH A U,V CLOSE TO THE CLUSTER          MAIN
C                                                                       MAIN
      IF(RELSTP.LT.ETA)RELSTP=ETA                                       MAIN
      RELSTP=SQRT(RELSTP)                                               MAIN
      U=U*(1.-RELSTP)                                                   MAIN
      V=V*(1.+RELSTP)                                                   MAIN
      CALL QUADSD(NN,COEFF,QP,A,B)                                      MAIN
      DO 160 I=1,5                                                      MAIN
      CALL CALCSC                                                       MAIN
  160 CALL NEXTK                                                        MAIN
      TRIED=.TRUE.                                                      MAIN
      IR=0                                                              MAIN
  165 OMP=PM                                                            MAIN
C                                                                       MAIN
C  CALCUALTE NEXT K POLYNOMIAL AND NEW U AND V                          MAIN
C                                                                       MAIN
      CALL CALCSC                                                       MAIN
      CALL NEXTK                                                        MAIN
      CALL CALCSC                                                       MAIN
      CALL NEWEST(COEFF(N),COEFF(NN))                                   MAIN
C                                                                       MAIN
C  ITERATION FAILS IF VI=0                                              MAIN
C                                                                       MAIN
      IF(VI.EQ.0.)GOTO 170                                              MAIN
      RELSTP=ABS((VI-V)/VI)                                             MAIN
      GOTO 145                                                          MAIN
C                                                                       MAIN
C******************* END SECTION QUADRATICITERATION ********************MAIN
C                                                                       MAIN
  170 IF(NZ.GT.0)GOTO 265                                               MAIN
C                                                                       MAIN
C QUADRATIC ITERATION HAS FAILED. FLAG THAT IT HAS BEEN TRIED           MAIN
C AND DECREASE THE CONVERGENCE CRITERION                                MAIN
C                                                                       MAIN
      VTRY=.TRUE.                                                       MAIN
      DF=.25*DF                                                         MAIN
C                                                                       MAIN
C TRY LINEAR ITERATION IF IT HAS NOT BEEN TRIED AND THE S SEQUENCE      MAIN
C IS CONVERGING                                                         MAIN
C                                                                       MAIN
      IF(STRY.OR.(.NOT.SPASS))GOTO 245                                  MAIN
      DO 175 I=1,N                                                      MAIN
  175 K(I)=SVK(I)                                                       MAIN
C                                                                       MAIN
C SECTION REALITERATION ************************************************MAIN
C                                                                       MAIN
C  VARIABLE-SHIFT K POLYNOMIAL ITERATION FOR A REAL ROOT                MAIN
C  S     - STARTING ITERATE                                             MAIN
C  IFLAG - FLAG TO INDICATE A PAIR OF ROOTS  NEAR REAL AXIS             MAIN
C                                                                       MAIN
  180 NZ=0                                                              MAIN
      IFLAG=0                                                           MAIN
C                                                                       MAIN
C  START MAIN LOOP                                                      MAIN
C                                                                       MAIN
      IR=0                                                              MAIN
C                                                                       MAIN
C  EVALUATE THE POLYNOMIAL AT S                                         MAIN
C                                                                       MAIN
  185 QP(1)=COEFF(1)                                                    MAIN
      DO 190 I=2,NN                                                     MAIN
  190 QP(I)=QP(I-1)*S+COEFF(I)                                          MAIN
      PM=ABS(QP(NN))                                                    MAIN
C                                                                       MAIN
C  COMPUTE A RIGOROUS BOUND ON THE ERROR IN EVALUATING THE POLYNOMIAL   MAIN
C                                                                       MAIN
      XM=ABS(S)                                                         MAIN
      FF=W1/W2*ABS(QP(1))                                               MAIN
      DO 195 I=2,NN                                                     MAIN
  195 FF=FF*XM+ABS(QP(I))                                               MAIN
C                                                                       MAIN
C  ITERATION HAS CONVERGED SUFFICIENTLY IF THE POLYNOMIAL               MAIN
C  VALUE IS LESS THAN 20 TIMES THIS BOUND                               MAIN
C                                                                       MAIN
      IF(PM.GT.20.*(FF*W2-W1*PM))GOTO 200                               MAIN
      NZ=1                                                              MAIN
      SZR=S                                                             MAIN
      SZI=0.                                                            MAIN
      GOTO 240                                                          MAIN
  200 IR=IR+1                                                           MAIN
C                                                                       MAIN
C  STOP ITERATION AFTER 10 STEPS                                        MAIN
C                                                                       MAIN
      IF(IR.GT.10)GOTO 240                                              MAIN
      IF(IR.LT.2)GOTO 205                                               MAIN
      IF(ABS(T).GT.1.E-03*ABS(S-T).OR.PM.LE.OMP)GOTO 205                MAIN
C                                                                       MAIN
C  A CLUSTER OF ROOTS  NEAR THE REAL AXIS HAS BEEN ENCOUNTERED          MAIN
C  RETURN WITH IFLAG SET TO INITIATE A QUADRATIC ITERATION              MAIN
C                                                                       MAIN
      IFLAG=1                                                           MAIN
      GOTO 240                                                          MAIN
C                                                                       MAIN
C  RETURN IF THE POLYNOMIAL VALUE HAS INCREASED SIGNIFICANTLY           MAIN
C                                                                       MAIN
  205 OMP=PM                                                            MAIN
C                                                                       MAIN
C  COMPUTE T, THE NEXT POLYNOMIAL, AND THE NEW ITERATE                  MAIN
C                                                                       MAIN
      QK(1)=K(1)                                                        MAIN
      DO 210 I=2,N                                                      MAIN
  210 QK(I)=QK(I-1)*S+K(I)                                              MAIN
      IF(ABS(QK(N)).LE.ABS(K(N))*10.*ETA)GOTO 220                       MAIN
      T=-QP(NN)/QK(N)                                                   MAIN
      K(1)=QP(1)                                                        MAIN
      DO 215 I=2,N                                                      MAIN
  215 K(I)=T*QK(I-1)+QP(I)                                              MAIN
      GOTO 230                                                          MAIN
  220 K(1)=0.                                                           MAIN
      DO 225 I=2,N                                                      MAIN
  225 K(I)=QK(I-1)                                                      MAIN
  230 CC=K(1)                                                           MAIN
      DO 235 I=2,N                                                      MAIN
  235 CC=CC*S+K(I)                                                      MAIN
      T=0.                                                              MAIN
      IF(ABS(CC).GT.ABS(K(N))*10.*ARE)T=-QP(NN)/CC                      MAIN
      S=S+T                                                             MAIN
      GOTO 185                                                          MAIN
C                                                                       MAIN
C******************* END SECTION REALITERATION *************************MAIN
C                                                                       MAIN
C LINEAR ITERATION HAS FAILED. FLAG THAT IT HAS BEEN TRIED              MAIN
C AND DECREASE THE CONVERGENCE CRITERION                                MAIN
C                                                                       MAIN
  240 IF(NZ.GT.0)GOTO 265                                               MAIN
      STRY=.TRUE.                                                       MAIN
      DX=.25*DX                                                         MAIN
      IF(IFLAG.EQ.0)GOTO 245                                            MAIN
C                                                                       MAIN
C IF LINEAR ITERATION SIGNALS AN ALMOST DOUBLE REAL ROOT                MAIN
C ATTEMPT QUADRATIC ITERATION                                           MAIN
C                                                                       MAIN
      UI=-(S+S)                                                         MAIN
      VI=S*S                                                            MAIN
      GOTO 140                                                          MAIN
C                                                                       MAIN
C RESTORE VARIABLES                                                     MAIN
C                                                                       MAIN
  245 U=AA                                                              MAIN
      V=BB                                                              MAIN
      DO 250 I=1,N                                                      MAIN
  250 K(I)=SVK(I)                                                       MAIN
C                                                                       MAIN
C TRY QUADRATIC ITERATION IF IT HAS NOT BEEN TRIED                      MAIN
C AND THE  V SEQUENCE IS CONVERGING                                     MAIN
C                                                                       MAIN
      IF(VPASS.AND.(.NOT.VTRY))GOTO 140                                 MAIN
C                                                                       MAIN
C RECOMPUTE QP AND SCALAR VALUES TO CONTINUE THE SECOND STAGE           MAIN
C                                                                       MAIN
      CALL QUADSD(NN,COEFF,QP,A,B)                                      MAIN
      CALL CALCSC                                                       MAIN
  255 OVV=VV                                                            MAIN
      OSS=SS                                                            MAIN
      OTV=TV                                                            MAIN
      OTS=TS                                                            MAIN
  260 CONTINUE                                                          MAIN
C                                                                       MAIN
C******************** END SECTION FIXSHIFT *****************************MAIN
C                                                                       MAIN
  265 IF(NZ.EQ.0)GOTO 305                                               MAIN
C                                                                       MAIN
C  THE SECOND STAGE(FIXSHIFT) JUMPS DIRECTLY TO ONE OF THE THIRD STAGE  MAIN
C  ITERATIONS(REALITERATION OR QUADRATICITERATION) AND RETURNS HERE IF  MAIN
C  SUCCESSFUL. DEFLATE THE POLYNOMIAL, STORE THE ROOT OR ROOTS          MAIN
C  RETURN TO THE MAIN ALGORITHM                                         MAIN
C                                                                       MAIN
      J=IDEGRE-N+1                                                      MAIN
      ROOT(J)=CMPLX(SZR,SZI)                                            MAIN
      IF(NZ.EQ.2)GOTO 275                                               MAIN
C                                                                       MAIN
C SECTION LINEARDEFLATION **********************************************MAIN
C                                                                       MAIN
C  COMPOSITE DEFLATION FOR A LINEAR FACTOR (PART I)                     MAIN
C                                                                       MAIN
C  SZR   - REAL ROOT                                                    MAIN
C  QP    - REDUCED POLYNOMIAL COEFFICIENTS                              MAIN
C  K     - NEW K POLYNOMIAL                                             MAIN
C  COEFF - POLYNOMIAL TO BE DEFLATED                                    MAIN
C                                                                       MAIN
C  DEFLATE POLYNOMIAL AND RECIPROCAL POLYNOMIAL                         MAIN
C                                                                       MAIN
      AA=1./SZR                                                         MAIN
      K(1)=COEFF(1)                                                     MAIN
      QP(N)=-AA*COEFF(NN)                                               MAIN
      DO 270 I=2,N                                                      MAIN
      K(I)=COEFF(I)+SZR*K(I-1)                                          MAIN
  270 QP(N-I+1)=AA*(QP(N-I+2)-COEFF(N-I+2))                             MAIN
      NNM1=N                                                            MAIN
      GOTO 285                                                          MAIN
C                                                                       MAIN
C******************* END SECTION LINEARDEFLATION ***********************MAIN
C                                                                       MAIN
C SECTION QUADRATICDEFLATION *******************************************MAIN
C                                                                       MAIN
C  COMPOSITE DEFLATION FOR A QUADRATIC FACTOR (PART I )                 MAIN
C                                                                       MAIN
C  U,V   - COEFFICIENTS OF THE QUADRATIC FACTOR                         MAIN
C  QP    - REDUCED POLYNOMIAL COEFFICIENTS                              MAIN
C  K     - NEW K POLYNOMIAL                                             MAIN
C  COEFF - POLYNOMIAL TO BE DEFLATED                                    MAIN
C                                                                       MAIN
C  DEFLATE POLYNOMIAL AND RECIPROCAL POLYNOMIAL                         MAIN
C                                                                       MAIN
  275 NNM1=NM1                                                          MAIN
      AA=1./V                                                           MAIN
      K(1)=COEFF(1)                                                     MAIN
      K(2)=COEFF(2)-U*K(1)                                              MAIN
      QP(NM1)=AA*COEFF(NN)                                              MAIN
      QP(N-2)=AA*(COEFF(N)-U*QP(NM1))                                   MAIN
      IF(NM1.LT.3)GOTO 285                                              MAIN
      DO 280 I=3,NM1                                                    MAIN
      K(I)=COEFF(I)-U*K(I-1)-V*K(I-2)                                   MAIN
  280 QP(N-I)=AA*(COEFF(N-I+2)-U*QP(N-I+1)+QP(N-I+2))                   MAIN
C                                                                       MAIN
C******************* END SECTION QUADRATICDEFLATION ********************MAIN
C                                                                       MAIN
C SECTION BOTHDEFLATION ************************************************MAIN
C                                                                       MAIN
C  COMPOSITE DEFLATION FOR LINEAR OR QUADRATIC FACTOR (PART II)         MAIN
C                                                                       MAIN
C  FIND CROSSOVER POINT WHERE DIFFERENCE BETWEEN POLYNOMIAL AND         MAIN
C  RECIPROCAL IS SMALLEST                                               MAIN
C                                                                       MAIN
  285 BB=ABS(K(1)-QP(1))/(ABS(K(1))+ABS(QP(1)))                         MAIN
      IR=1                                                              MAIN
      DO 290 I=2,NNM1                                                   MAIN
      AA=ABS(K(I))+ABS(QP(I))                                           MAIN
      IF(AA.EQ.0.)GOTO 290                                              MAIN
      T=ABS((ABS(K(I))-ABS(QP(I)))/AA)                                  MAIN
      IF(T.GE.BB)GOTO 290                                               MAIN
      BB=T                                                              MAIN
      IR=I                                                              MAIN
  290 CONTINUE                                                          MAIN
C                                                                       MAIN
C  MERGE THE TWO REDUCED POLYNOMIALS                                    MAIN
C                                                                       MAIN
      DO 295 I=1,IR                                                     MAIN
  295 QP(I)=K(I)                                                        MAIN
      IF(IR.LT.NNM1)QP(IR+1)=.5*(K(IR+1)+QP(IR+1))                      MAIN
C                                                                       MAIN
C******************* END SECTION BOTHDEFLATION *************************MAIN
C                                                                       MAIN
      NN=NN-NZ                                                          MAIN
      N=NN-1                                                            MAIN
      DO 300 I=1,NN                                                     MAIN
  300 COEFF(I)=QP(I)                                                    MAIN
      IF(NZ.EQ.1)GOTO 55                                                MAIN
      ROOT(J+1)=CMPLX(ZLR,ZLI)                                          MAIN
      GOTO 55                                                           MAIN
C                                                                       MAIN
C  IF THE ITERATION IS UNSUCCESSFUL ANOTHER QUADRATIC                   MAIN
C  IS CHOSEN AFTER RESTORING K                                          MAIN
C                                                                       MAIN
  305 DO 310 I=1,N                                                      MAIN
  310 K(I)=TEMP(I)                                                      MAIN
  315 CONTINUE                                                          MAIN
C                                                                       MAIN
C  THE ZEROFINDER HAS FAILED TO FIND ANY OR ALL ROOTS IN 10 SHIFTS      MAIN
C                                                                       MAIN
      GOTO 5                                                            MAIN
      END                                                               MAIN
      SUBROUTINE CALCSC                                                 MAIN
C                                                                       MAIN
C THIS ROUTINE CALCULATES SCALAR QUANTITIES USED TO COMPUTE THE NEXT K  MAIN
C POLYNOMIAL AND NEW ESTIMATES OF THE QUADRATIC COEFFICIENTS            MAIN
C                                                                       MAIN
C ITYPE - INTEGER VARIABLE SET HERE INDICATING HOW THE CALCULATIONS     MAIN
C         SHOULD BE NORMALIZED TO AVOID OVERFLOW                        MAIN
C                                                                       MAIN
      COMMON/GLOBAL/QP,K,QK,U,V,A,B,C,D,E,F,G,H,A1,A3,A7,ITYPE,ETA,NM1, MAIN
     $              N,NN,UI,VI                                          MAIN
C                                                                       MAIN
      DIMENSION QP(050),K(049),QK(049)                                  MAIN
      REAL K                                                            MAIN
C                                                                       MAIN
C SYNTHETIC DIVISION OF K BY THE QUADRATIC 1,U,V                        MAIN
C                                                                       MAIN
      CALL QUADSD(N,K,QK,C,D)                                           MAIN
      IF(ABS(C).GT.ABS(K(N))*1.E+2*ETA)GOTO 5                           MAIN
      IF(ABS(D).GT.ABS(K(NM1))*1.E+2*ETA)GOTO 5                         MAIN
      ITYPE=3                                                           MAIN
C                                                                       MAIN
C ITYPE=3 INDICATES THE QUADRATIC IS ALMOST A FACTOR OF K               MAIN
C                                                                       MAIN
      RETURN                                                            MAIN
    5 A1=D                                                              MAIN
      IF(ABS(D).LT.ABS(C))A1=C                                          MAIN
      H=V*B                                                             MAIN
      E=A/A1                                                            MAIN
      A3=(A*A+B*(U*A+H))/A1                                             MAIN
      IF(A1.EQ.C)GOTO 10                                                MAIN
      ITYPE=2                                                           MAIN
C                                                                       MAIN
C ITYPE=2 INDICATES THAT ALL FORMULAS ARE DIVIDED BY D                  MAIN
C                                                                       MAIN
      F=C/D                                                             MAIN
      G=U*B                                                             MAIN
      A1=B*F-A                                                          MAIN
      A7=(F+U)*A+H                                                      MAIN
      RETURN                                                            MAIN
   10 ITYPE=1                                                           MAIN
C                                                                       MAIN
C ITYPE=1 INDICATES THAT ALL FORMULAS ARE DIVIDED BY C                  MAIN
C                                                                       MAIN
      F=D/C                                                             MAIN
      G=U*E                                                             MAIN
      A1=B-A*F                                                          MAIN
      A7=A+G*D+H*F                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NEXTK                                                  MAIN
C                                                                       MAIN
C COMPUTES THE NEXT K POLYNOMIALS USING SCALARS COMPUTED IN CALCSC      MAIN
C                                                                       MAIN
      COMMON/GLOBAL/QP,K,QK,U,V,A,B,C,D,E,F,G,H,A1,A3,A7,ITYPE,ETA,NM1, MAIN
     $              N,NN,UI,VI                                          MAIN
C                                                                       MAIN
      DIMENSION QP(050),K(049),QK(049)                                  MAIN
      REAL K                                                            MAIN
C                                                                       MAIN
      IF(ITYPE.EQ.3)GOTO 20                                             MAIN
C                                                                       MAIN
C IF A1=0 USE THE UNSCALED VERSION OF THE RECURRENCE                    MAIN
C                                                                       MAIN
      TEMP=A                                                            MAIN
      IF(ITYPE.EQ.1)TEMP=B                                              MAIN
      IF(ABS(A1).GT.ABS(TEMP)*ETA*1.E+1)GOTO 10                         MAIN
      K(1)=0.                                                           MAIN
      K(2)=-A7*QP(1)                                                    MAIN
      DO 5 I=3,N                                                        MAIN
    5 K(I)=A3*QK(I-2)-A7*QP(I-1)                                        MAIN
      RETURN                                                            MAIN
   10 A7=A7/A1                                                          MAIN
      A3=A3/A1                                                          MAIN
      K(1)=QP(1)                                                        MAIN
      K(2)=QP(2)-A7*QP(1)                                               MAIN
      DO 15 I=3,N                                                       MAIN
   15 K(I)=A3*QK(I-2)-A7*QP(I-1)+QP(I)                                  MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
C IF ITYPE=3 USE QK AS K                                                MAIN
C                                                                       MAIN
   20 K(1)=0.                                                           MAIN
      K(2)=0.                                                           MAIN
      DO 25 I=3,N                                                       MAIN
   25 K(I)=QK(I-2)                                                      MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE NEWEST(AA,BB)                                          MAIN
C                                                                       MAIN
C COMPUTE NEW ESTIMATES OF THE QUADRATIC COEFFICIENTS                   MAIN
C USING THE SCALARS COMPUTED IN CALCSC                                  MAIN
C                                                                       MAIN
      COMMON/GLOBAL/QP,K,QK,U,V,A,B,C,D,E,F,G,H,A1,A3,A7,ITYPE,ETA,NM1, MAIN
     $              N,NN,UI,VI                                          MAIN
C                                                                       MAIN
      DIMENSION QP(050),K(049),QK(049)                                  MAIN
      REAL K                                                            MAIN
C                                                                       MAIN
C USE FORMULAS APPROPRIATE TO VALUE OF ITYPE                            MAIN
C                                                                       MAIN
      IF(ITYPE.EQ.3)GOTO 15                                             MAIN
      IF(ITYPE.EQ.2)GOTO 5                                              MAIN
      A4=A+U*B+H*F                                                      MAIN
      A5=C+(U+V*F)*D                                                    MAIN
      GOTO 10                                                           MAIN
    5 A4=(A+G)*F+H                                                      MAIN
      A5=(F+U)*C+V*D                                                    MAIN
C                                                                       MAIN
C EVALUATE NEW QUADRATIC COEFFICIENTS                                   MAIN
C                                                                       MAIN
   10 B1=-K(N)/BB                                                       MAIN
      B2=-(K(NM1)+B1*AA)/BB                                             MAIN
      C1=V*B2*A1                                                        MAIN
      C2=B1*A7                                                          MAIN
      C3=B1*B1*A3                                                       MAIN
      C4=C1-C2-C3                                                       MAIN
      C1=A5+B1*A4-C4                                                    MAIN
      IF(C1.EQ.0.)GOTO 15                                               MAIN
      UI=U-(U*(C3+C2)+V*(B1*A1+B2*A7))/C1                               MAIN
      VI=V*(1.+C4/C1)                                                   MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
C IF  ITYPE=3 THE QUADRATIC IS ZEROED                                   MAIN
C                                                                       MAIN
   15 UI=0.                                                             MAIN
      VI=0.                                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QUADSD(L1,PP,QQ,AA,BB)                                 MAIN
C                                                                       MAIN
C DIVIDES PP BY THE QUADRATIC 1,U,V PLACING THE  QUOTIENT QQ AND THE    MAIN
C REMAINDER IN AA,BB                                                    MAIN
C                                                                       MAIN
      COMMON/GLOBAL/QP,K,QK,U,V,A,B,C,D,E,F,G,H,A1,A3,A7,ITYPE,ETA,NM1, MAIN
     $              N,NN,UI,VI                                          MAIN
C                                                                       MAIN
      DIMENSION QP(050),K(049),QK(049),QQ(1),PP(1)                      MAIN
      REAL K                                                            MAIN
C                                                                       MAIN
      QQ(1)=PP(1)                                                       MAIN
      QQ(2)=PP(2)-U*QQ(1)                                               MAIN
      DO 5 I=3,L1                                                       MAIN
    5 QQ(I)=PP(I)-U*QQ(I-1)-V*QQ(I-2)                                   MAIN
      AA=QQ(L1)                                                         MAIN
      BB=QQ(L1-1)                                                       MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE QUAD(AA,BB,CC,SZR,SZI,ZLR,ZLI)                         MAIN
C                                                                       MAIN
C FINDS THE ROOTS OF THE QUADRATIC A*Z**2 + 2*B*Z + C                   MAIN
C THE QUADRATIC FORMULA, MODIFIED TO AVOID OVERFLOW, IS USED TO FIND    MAIN
C THE LARGER ROOT IF THE ROOTS ARE REAL AND BOTH ROOTS IF               MAIN
C THE ROOTS ARE COMPLEX.  THE SMALLER REAL ROOT IS FOUND DIRECTLY FROM  MAIN
C THE PRODUCT OF THE ROOTS CC/AA                                        MAIN
C                                                                       MAIN
      IF(AA.NE.0.)GOTO 5                                                MAIN
      IF(BB.EQ.0.)GOTO 10                                               MAIN
      ZLR=-CC/(BB+BB)                                                   MAIN
      GOTO 15                                                           MAIN
    5 IF(CC.NE.0..OR.BB.NE.0.)GOTO 25                                   MAIN
   10 ZLR=0.                                                            MAIN
   15 SZR=0.                                                            MAIN
   20 ZLI=0.                                                            MAIN
      SZI=0.                                                            MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
C COMPUTE DISCRIMINANT AVOIDING OVERFLOW                                MAIN
C                                                                       MAIN
   25 IF(ABS(BB).LT.ABS(CC))GOTO 30                                     MAIN
      SZI=1.-AA*CC/(BB*BB)                                              MAIN
      ZLI=SQRT(ABS(SZI))*ABS(BB)                                        MAIN
      GOTO 35                                                           MAIN
   30 SZI=AA                                                            MAIN
      IF(CC.LE.0.)SZI=-AA                                               MAIN
      SZI=BB*(BB/ABS(CC))-SZI                                           MAIN
      ZLI=SQRT(ABS(SZI*CC))                                             MAIN
   35 IF(SZI)45,40,40                                                   MAIN
   40 IF(BB.GE.0.)ZLI=-ZLI                                              MAIN
      ZLR=(-BB+ZLI)/AA                                                  MAIN
      SZR=0.                                                            MAIN
      IF(ZLR.NE.0.)SZR=CC/(ZLR*AA)                                      MAIN
      GOTO 20                                                           MAIN
   45 SZR=-BB/AA                                                        MAIN
      ZLR=SZR                                                           MAIN
      SZI=ABS(ZLI/AA)                                                   MAIN
      ZLI=-SZI                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE FTLUP (X,Y,M,N,VARI,VARD)                              MAIN
*********DOCUMENT DATE  7/7/69     SUBROUTINE REVISED  7/7/69  *********MAIN
*        MODIFICATION OF LIBRARY INTERPOLATION SUBROUTINE  FTLUP        MAIN
      DIMENSION VARI(1),VARD(1),V(3),YY(2)                              MAIN
      DIMENSION II(43)                                                  MAIN
*                                                                       MAIN
*      INITIALIZE ALL INTERVAL POINTERS TO -1.0   FOR MONOTONICITY CHECKMAIN
      DATA (II(J),J=1,43)/43*-1/                                        MAIN
      MA=IABS(M)                                                        MAIN
*                                                                       MAIN
*            ASSIGN INTERVAL POINTER FOR GIVEN VARI TABLE               MAIN
*      THE SAME POINTER WILL BE USED ON A GIVEN VARI TABLE EVERY TIME   MAIN
      LI=MOD(LOCF(VARI(1)),43)+1                                        MAIN
      I=II(LI)                                                          MAIN
      IF (I.GE.0) GO TO 10                                              MAIN
      IF (N.LT.2) GO TO 10                                              MAIN
*                                                                       MAIN
* MONOTONICITY CHECK                                                    MAIN
      IF (VARI(2)-VARI(1)) 1,1,3                                        MAIN
*  ERROR IN MONOTONICITY                                                MAIN
    2 K=LOCF (VARI(1))                                                  MAIN
      PRINT 102,J,K,(VARI(J),J=1,N),(VARD(J),J=1,N)                     MAIN
  102 FORMAT (1H1,* TABLE BELOW OUT OF ORDER FOR FTLUP  AT POSITION  *  MAIN
     1,I5,/* X TABLE IS STORED IN LOCATION *,O6,//(8G15.8))             MAIN
      STOP                                                              MAIN
*  MONOTONIC DECREASING                                                 MAIN
    1 DO 5 J=2,N                                                        MAIN
      IF (VARI(J)-VARI(J-1))5,2,2                                       MAIN
    5 CONTINUE                                                          MAIN
      GO TO 10                                                          MAIN
*  MONOTONIC INCREASING                                                 MAIN
    3 DO 6 J=2,N                                                        MAIN
      IF (VARI(J)-VARI(J-1))2,2,6                                       MAIN
    6 CONTINUE                                                          MAIN
*                                                                       MAIN
* INTERPOLATION                                                         MAIN
   10 IF (I.LE.0) I=1                                                   MAIN
      IF (I.GE.N) I=N-1                                                 MAIN
      IF (N.LE.1) GO TO 8                                               MAIN
      IF (MA.NE.0) GO TO 99                                             MAIN
*  ZERO ORDER                                                           MAIN
    8 Y=VARD(1)                                                         MAIN
      GO TO 800                                                         MAIN
*  LOCATE I INTERVAL (X(I).LE.X.LT.X(I+1))                              MAIN
   99 IF ((VARI(I)-X)*(VARI(I+1)-X)) 61,61,40                           MAIN
*  IN GIVES DIRECTION FOR SEARCH OF INTERVALS                           MAIN
   40 IN=SIGN(1.0,(VARI(I+1)-VARI(I))*(X-VARI(I)))                      MAIN
*  IF X OUTSIDE ENDPOINTS, EXTRAPOLATE FROM END INTERVAL                MAIN
   41 IF ((I+IN).LE.0) GO TO 61                                         MAIN
      IF ((I+IN).GE.N) GO TO 61                                         MAIN
      I=I+IN                                                            MAIN
      IF ((VARI(I)-X)*(VARI(I+1)-X)) 61,61,41                           MAIN
   61 IF (MA.EQ.2) GO TO 200                                            MAIN
*                                                                       MAIN
* FIRST ORDER                                                           MAIN
      Y=(VARD(I)*(VARI(I+1)-X)-VARD(I+1)*(VARI(I)-X))/(VARI(I+1)-VARI(I)MAIN
     1   )                                                              MAIN
      GO TO 800                                                         MAIN
*                                                                       MAIN
* SECOND ORDER                                                          MAIN
  200 IF (N.EQ.2) GO TO 2                                               MAIN
      IF (I.EQ.(N-1)) GO TO 209                                         MAIN
      IF (I.EQ.1) GO TO 201                                             MAIN
*  PICK THIRD POINT                                                     MAIN
      SK= VARI(I+1)-VARI(I)                                             MAIN
      IF ((SK*(X-VARI(I-1))).LT.(SK*(VARI(I+2)-X))) GO TO 209           MAIN
  201 L=I                                                               MAIN
      GO TO 702                                                         MAIN
  209 L=I-1                                                             MAIN
  702 V(1)=VARI(L)-X                                                    MAIN
      V(2)=VARI(L+1)-X                                                  MAIN
      V(3)=VARI(L+2)-X                                                  MAIN
      YY(1)=(VARD(L)*V(2)-VARD(L+1)*V(1))/(VARI(L+1)-VARI(L))           MAIN
      YY(2)=(VARD(L+1)*V(3)-VARD(L+2)*V(2))/(VARI(L+2)-VARI(L+1))       MAIN
      Y=(YY(1)*V(3)-YY(2)*V(1))/(VARI(L+2)-VARI(L))                     MAIN
  800 II(LI)=I                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX20                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HPOWER,J0001)                                      MAIN
      GO TO (90001,50), J0001                                           MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,50), J0002                                           MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,50), J0003                                           MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      TYPE = 1.0                                                        MAIN
      GO TO 10                                                          MAIN
   50 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRATIO,J0004)                                      MAIN
      GO TO (90004,100), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,100), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,100), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      TYPE = 2.0                                                        MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HGIVEN,J0007)                                      MAIN
      GO TO (90007,200), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HTIME,J0008)                                       MAIN
      GO TO (90008,10), J0008                                           MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0009)                                          MAIN
      GO TO (90009,10), J0009                                           MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0010)                                          MAIN
      GO TO (90010,10), J0010                                           MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PLOTE(NN)                                              MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE DISCOT (XA,ZA,TABX,TABY,TABZ,NC,NY,NZ,ANS,MISTAK)      MAIN
C     THE DIMENSIONS IN THIS SUBROUTINE ARE ONLY DUMMY DIMENSIONS.      MAIN
      DIMENSION TABX(2),TABY(2),TABZ(2),NPX(8),NPY(8),YY(8)             MAIN
C     DIMENSION TABX(2),TABY(2),TABZ(2),NPX(8),NPY(8),YY(8)             MAIN
      MISTAK=0                                                          MAIN
      CALL UNS (NC,IA,IDX,IDZ,IMS)                                      MAIN
      IF (NZ-1)   5,5,10                                                MAIN
    5 CALL DISSER (XA,TABX(1),1,NY,IDX,NN)                              MAIN
      NNN=IDX+1                                                         MAIN
      CALL LAGRAN (XA,TABX(NN),TABY(NN),NNN,ANS)                        MAIN
      GOTO 70                                                           MAIN
   10 ZARG=ZA                                                           MAIN
      IP1X=IDX+1                                                        MAIN
      IP1Z=IDZ+1                                                        MAIN
      NX=NY/NZ                                                          MAIN
      IF (IA)   15,25,15                                                MAIN
   15 IF(TABX(1).GT.XA)GOTO101                                          MAIN
      IF(TABX(NX).LT.XA)GOTO102                                         MAIN
      IF(TABZ(NZ).LT.ZA)GOTO102                                         MAIN
      IF(TABZ(1).LE.ZA)GOTO25                                           MAIN
  101 MISTAK=1                                                          MAIN
      WRITE(6,502)                                                      MAIN
  502 FORMAT(29H TABLE LIMIT EXCEEDED,POINT 1)                          MAIN
      WRITE(6,506)TABX(1),XA,TABX(NX),NX,TABZ(NZ),NZ,ZA,TABZ(1)         MAIN
  506 FORMAT(2X,8HTABX(1)=E15.8,5H  XA=E15.8,11H  TABX(NX)=E15.8,5H  NX=MAIN
     1I3/11H  TABZ(NZ)=E15.8,5H  NZ=I3,5H  ZA=E15.8,10H  TABZ(1)=E15.8) MAIN
      RETURN                                                            MAIN
  102 MISTAK=1                                                          MAIN
      WRITE(6,503)                                                      MAIN
  503 FORMAT(29H TABLE LIMIT EXCEEDED,POINT 2)                          MAIN
      WRITE(6,507)TABX(1),XA,TABX(NX),NX,TABZ(NZ),NZ,ZA,TABZ(1)         MAIN
  507 FORMAT(2X,8HTABX(1)=E15.8,5H  XA=E15.8,11H  TABX(NX)=E15.8,5H  NX=MAIN
     1I3/11H  TABZ(NZ)=E15.8,5H  NZ=I3,5H  ZA=E15.8,10H  TABZ(1)=E15.8) MAIN
      RETURN                                                            MAIN
   25 CALL DISSER (ZARG,TABZ(1),1,NZ,IDZ,NPZ)                           MAIN
      NPZL=NPZ+IDZ                                                      MAIN
      I=1                                                               MAIN
      IF (IMS)   30,30,40                                               MAIN
   30 CALL DISSER (XA,TABX(1),1,NX,IDX,NPX(1))                          MAIN
      DO 35 JJ=NPZ,NPZL                                                 MAIN
      NPY(I)=(JJ-1)*NX+NPX(1)                                           MAIN
      NPX(I)=NPX(1)                                                     MAIN
   35 I=I+1                                                             MAIN
      MSTOP1=NPY(1)                                                     MAIN
      MSTOP2=NPY(2)                                                     MAIN
      IF(TABY(MSTOP1).EQ.0.)GO TO 100                                   MAIN
      IF(TABY(MSTOP2).EQ.0.)GO TO 100                                   MAIN
      IF(TABY(MSTOP1+1).EQ.0.)GO TO 100                                 MAIN
      IF(TABY(MSTOP2+1).NE.0.)GO TO 50                                  MAIN
  100 MISTAK=1                                                          MAIN
      WRITE(6,501)                                                      MAIN
  501 FORMAT(29H TABLE LIMIT EXCEEDED,POINT 3)                          MAIN
      WRITE(6,508)TABY(MSTOP1),MSTOP1,TABY(MSTOP2),MSTOP2,TABY(MSTOP1+1)MAIN
  508 FORMAT(2X,13HTABY(MSTOP1)=E15.8,9H  MSTOP1=I3,15H  TABY(MSTOP2)=E1MAIN
     15.8,9H  MSTOP2=I3,17H  TABY(MSTOP1+1)=E15.8)                      MAIN
      RETURN                                                            MAIN
   40 DO 45 JJ=NPZ,NPZL                                                 MAIN
      IS=(JJ-1)*NX+1                                                    MAIN
      CALL DISSER (XA,TABX(1),IS,NX,IDX,NPX(I))                         MAIN
      NPY(I)=NPX(I)                                                     MAIN
   45 I=I+1                                                             MAIN
   50 DO 55 I=1,IP1Z                                                    MAIN
      NLOC=NPX(I)                                                       MAIN
      NLOCY=NPY(I)                                                      MAIN
   55 CALL LAGRAN (XA,TABX(NLOC),TABY(NLOCY),IP1X,YY(I))                MAIN
      CALL LAGRAN (ZARG,TABZ(NPZ),YY(1),IP1Z,ANS)                       MAIN
   70 RETURN                                                            MAIN
      END                                                               MAIN
C                                                                       MAIN
      SUBROUTINE UNS (IC,IA,IDX,IDZ,IMS)                                MAIN
      IF (IC)   5,5,10                                                  MAIN
    5 IMS=1                                                             MAIN
      NC=-IC                                                            MAIN
      GOTO 15                                                           MAIN
   10 IMS=0                                                             MAIN
      NC=IC                                                             MAIN
   15 IF (NC-100)   20,25,25                                            MAIN
   20 IA=0                                                              MAIN
      GOTO 30                                                           MAIN
   25 IA=1                                                              MAIN
      NC=NC-100                                                         MAIN
   30 IDX=NC/10                                                         MAIN
      IDZ=NC-IDX*10                                                     MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
C                                                                       MAIN
      SUBROUTINE LAGRAN (XA,X,Y,N,ANS)                                  MAIN
      DIMENSION X(2),Y(2)                                               MAIN
      SUM=0.0                                                           MAIN
      DO 3 I=1,N                                                        MAIN
      PROD=Y(I)                                                         MAIN
      DO 2 J=1,N                                                        MAIN
      A=X(I)-X(J)                                                       MAIN
      IF (A)   1,2,1                                                    MAIN
    1 B=(XA-X(J))/A                                                     MAIN
      PROD=PROD*B                                                       MAIN
    2 CONTINUE                                                          MAIN
    3 SUM=SUM+PROD                                                      MAIN
      ANS=SUM                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
C                                                                       MAIN
      SUBROUTINE DISSER (XA,TAB,I,NX,ID,NPX)                            MAIN
      DIMENSION TAB(2)                                                  MAIN
C     DIMENSION TAB(2)                                                  MAIN
      NPT=ID+1                                                          MAIN
      NPB=NPT/2                                                         MAIN
      NPU=NPT-NPB                                                       MAIN
      IF (NX-NPT)   10,5,10                                             MAIN
    5 NPX=I                                                             MAIN
      RETURN                                                            MAIN
   10 NLOW=I+NPB                                                        MAIN
      NUPP=I+NX-(NPU+1)                                                 MAIN
      DO 15 II=NLOW,NUPP                                                MAIN
      NLOC=II                                                           MAIN
      IF (TAB(II)-XA)   15,20,20                                        MAIN
   15 CONTINUE                                                          MAIN
      NPX=NUPP-NPB+1                                                    MAIN
      RETURN                                                            MAIN
   20 NL=NLOC-NPB                                                       MAIN
      NU=NL+ID                                                          MAIN
      DO 25 JJ=NL,NU                                                    MAIN
      NDIS=JJ                                                           MAIN
      IF (TAB(JJ)-TAB(JJ+1))   25,30,25                                 MAIN
   25 CONTINUE                                                          MAIN
      NPX=NL                                                            MAIN
      RETURN                                                            MAIN
   30 IF (TAB(NDIS)-XA)   40,35,35                                      MAIN
   35 NPX=NDIS-ID                                                       MAIN
      RETURN                                                            MAIN
   40 NPX=NDIS+1                                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE PLOTS(X,I,J)                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE VOIDXX(RG, NSR)                                        MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG(152), AVOID1)                                  MAIN
      EQUIVALENCE (XNSEG(153), AVOID2)                                  MAIN
      EQUIVALENCE (XNSEG(154), ISEG  )                                  MAIN
      EQUIVALENCE(N1, AVOID1)                                           MAIN
      EQUIVALENCE(N2, AVOID2)                                           MAIN
      INTEGER AVOID1, AVOID2                                            MAIN
      REAL RG(1)                                                        MAIN
      NSR = 0                                                           MAIN
      IF(N1 .EQ. 0)  RETURN                                             MAIN
      IF(ISEG .LT. N1  .OR.  ISEG .GT. N2)  RETURN                      MAIN
      WT = RG(ITZ)                                                      MAIN
      H = RG(ITZ +1)                                                    MAIN
      AM = RG(ITZ +2)                                                   MAIN
      NSR = 1                                                           MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XALT                                                   MAIN
      COMMON /COMSEG/ XNSEG(775)                                        MAIN
      EQUIVALENCE (XNSEG( 94), H     )                                  MAIN
      EQUIVALENCE (XNSEG(176), ATMOS )                                  MAIN
      REAL ATMOS(20)                                                    MAIN
      EQUIVALENCE (ATMOS(5),PR)                                         MAIN
                                                                        MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C              PROVIDES ALTITUDE FOR A GIVEN PRESSURE RATIO             MAIN
C     ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   ***   MAIN
C     U. S. STANDARD ATMOSPHERE, 1962 (6/3/70  GAT + CJF)               MAIN
C     (GOOD TO 105,000. FT.)                                            MAIN
                                                                        MAIN
      IF(PR-0.223361)905,905,904                                        MAIN
904   TR=PR**0.1902532                                                  MAIN
      H=145448.6*(1.0-TR)                                               MAIN
      GOTO910                                                           MAIN
905   IF(PR-0.0540328)907,906,906                                       MAIN
906   H=36089.2+ALOG(0.223361/PR)/(4.80637E-05)                         MAIN
      GOTO910                                                           MAIN
907   PRA=(18.507277*PR)**0.0292369                                     MAIN
      TR=0.751865/PRA                                                   MAIN
      H = (TR-0.751865)/0.10578E-05 + 65616.798                         MAIN
910   IF(H.LT.0.)H=0.                                                   MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XFIT2(X1,X2,X3,Y1,Y2,Y3,AA,BB,CC,XATYM,YM,XR,XRR)      MAIN
      Y=AA+BB*X+CC*X*X                                                  MAIN
      CC=1./(X2-X3)*((Y2-Y1)/(X2-X1)-(Y3-Y1)/(X3-X1))                   MAIN
      BB=(Y2-Y1)/(X2-X1)-CC*(X2+X1)                                     MAIN
      AA=Y1-BB*X1-CC*X1*X1                                              MAIN
      XATYM=-BB/(2.*CC)                                                 MAIN
      YM=AA-BB*BB/(4.*CC)                                               MAIN
      XMIN = AMIN1(X1, X2, X3)                                          MAIN
      XMAX = AMAX1(X1, X2, X3)                                          MAIN
      IF(XATYM .LT. XMIN)  GO TO 10                                     MAIN
      IF(XATYM .GT. XMAX)  GO TO 10                                     MAIN
      RETURN                                                            MAIN
C                                                                       MAIN
   10 CONTINUE                                                          MAIN
      YM = AMAX1(Y1, Y2, Y3)                                            MAIN
      IF(YM .EQ. Y1)  XATYM = X1                                        MAIN
      IF(YM .EQ. Y2)  XATYM = X2                                        MAIN
      IF(YM .EQ. Y3)  XATYM = X3                                        MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE XNLTST(NLTYPE)                                         MAIN
      COMMON /XREADX/ RDATA(136)                                        MAIN
      EQUIVALENCE (CARD  , RDATA(  1))                                  MAIN
      EQUIVALENCE (INC   , RDATA( 82))                                  MAIN
      EQUIVALENCE (NX    , RDATA( 94))                                  MAIN
      INTEGER CARD(80)                                                  MAIN
      LOGICAL NLTYPE                                                    MAIN
      INTEGER CHR(13)                                                   MAIN
      DATA CHR /1H0, 1H1, 1H2, 1H3, 1H4, 1H5, 1H6, 1H7, 1H8, 1H9,       MAIN
     1          1H+, 1H-, 1H./                                          MAIN
      NLTYPE = .FALSE.                                                  MAIN
      DO 100 I=1,13                                                     MAIN
      IF(CARD(1) .NE. CHR(I))  GO TO 100                                MAIN
      NLTYPE = .TRUE.                                                   MAIN
      INC = INC +NX                                                     MAIN
      RETURN                                                            MAIN
  100 CONTINUE                                                          MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXXX                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /COMSEG/ XNSEG(1)                                          MAIN
      EQUIVALENCE (XNSEG(156), NUMSEG)                                  MAIN
      EQUIVALENCE (XNSEG(359), LOCTZ )                                  MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      EQUIVALENCE (TERM(8), INX)                                        MAIN
      LOGICAL NOEND                                                     MAIN
      NUM = NUMSEG                                                      MAIN
   10 CONTINUE                                                          MAIN
      DO 11 I=1,10                                                      MAIN
      TERM(I) = 0.0                                                     MAIN
   11 CONTINUE                                                          MAIN
      REVCAL = 0.0                                                      MAIN
      NOEND = .TRUE.                                                    MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HOPTION(,J0001)                                    MAIN
      GO TO (90001,10), J0001                                           MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0002)                                          MAIN
      GO TO (90002,10), J0002                                           MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INX)                                           MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HSEGMENT(,J0003)                                   MAIN
      GO TO (90003,20), J0003                                           MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0004)                                          MAIN
      GO TO (90004,20), J0004                                           MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, NUMSEG)                                        MAIN
      GO TO 30                                                          MAIN
   20 CONTINUE                                                          MAIN
      NUMSEG = NUMSEG +1                                                MAIN
   30 CONTINUE                                                          MAIN
      CALL PICINX(INX)                                                  MAIN
      CALL FILLTZ                                                       MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HMISSION,J0005)                                    MAIN
      GO TO (90006,90005), J0005                                        MAIN
90006 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 90005                                     MAIN
      CALL QXDEN                                                        MAIN
      GO TO 100                                                         MAIN
90005 CONTINUE                                                          MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      IF(NUM .GT. NUMSEG)  NUMSEG = NUM                                 MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX1                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0004)                                   MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HUSEMAX,J0007)                                     MAIN
      GO TO (90007,300), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(9,9HEDOT/MDOT,J0008)                                  MAIN
      GO TO (90008,210), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      INDMHP = 2                                                        MAIN
      GO TO 10                                                          MAIN
  210 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HEDOT,J0009)                                       MAIN
      GO TO (90009,220), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      INDMHP = 1                                                        MAIN
      GO TO 10                                                          MAIN
  220 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HL/D,J0010)                                        MAIN
      GO TO (90010,230), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      INDMHP = 3                                                        MAIN
      GO TO 10                                                          MAIN
  230 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(11,11HRANGEFACTOR,J0011)                              MAIN
      GO TO (90011,240), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      INDMHP = 4                                                        MAIN
      GO TO 10                                                          MAIN
  240 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(10,10HL/(FN-DRT),J0012)                               MAIN
      GO TO (90012,10), J0012                                           MAIN
90012 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      INDMHP = 5                                                        MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HCONSTANT,J0013)                                   MAIN
      GO TO (90013,400), J0013                                          MAIN
90013 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HENERGY,J0014)                                     MAIN
      GO TO (90014,310), J0014                                          MAIN
90014 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      IPATH = 1                                                         MAIN
      GO TO 10                                                          MAIN
  310 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0015)                                   MAIN
      GO TO (90015,320), J0015                                          MAIN
90015 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      IPATH = 2                                                         MAIN
      GO TO 10                                                          MAIN
  320 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0016)                                       MAIN
      GO TO (90016,330), J0016                                          MAIN
90016 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      IPATH = 3                                                         MAIN
      GO TO 10                                                          MAIN
  330 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(1,1HQ,J0017)                                          MAIN
      GO TO (90017,10), J0017                                           MAIN
90017 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      IPATH = 5                                                         MAIN
      GO TO 10                                                          MAIN
  400 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HLINEAR,J0018)                                     MAIN
      GO TO (90018,500), J0018                                          MAIN
90018 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      IPATH = 4                                                         MAIN
      GO TO 10                                                          MAIN
  500 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(3) = FLOAT(INDMHP)                                           MAIN
      TERM(4) = FLOAT(IPATH)                                            MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX2                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0004)                                   MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HDESCENT,J0007)                                    MAIN
      GO TO (90007,300), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TERM(5) = 1.0                                                     MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX3                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HSTART,J0001)                                      MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(3,3HLEG,J0002)                                        MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0004)                                          MAIN
      GO TO (90004,100), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(6,6HRETURN,J0005)                                     MAIN
      GO TO (90006,90005), J0005                                        MAIN
90006 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 90005                                     MAIN
      CALL QXDEN                                                        MAIN
      GO TO 50                                                          MAIN
90005 CONTINUE                                                          MAIN
      TERM(1) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
   50 CONTINUE                                                          MAIN
      TERM(3) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(3,3HEND,J0006)                                        MAIN
      GO TO (90007,200), J0006                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIFRC(3,3HLEG,J0007)                                        MAIN
      GO TO (90008,200), J0007                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0008)                                          MAIN
      GO TO (90009,200), J0008                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0009)                                          MAIN
      GO TO (90010,200), J0009                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(6,6HRETURN,J0010)                                     MAIN
      GO TO (90012,90011), J0010                                        MAIN
90012 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 90011                                     MAIN
      CALL QXDEN                                                        MAIN
      GO TO 150                                                         MAIN
90011 CONTINUE                                                          MAIN
      TERM(2) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  150 CONTINUE                                                          MAIN
      TERM(4) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(6,6HADJUST,J0011)                                     MAIN
      GO TO (90013,300), J0011                                          MAIN
90013 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0012)                                          MAIN
      GO TO (90014,300), J0012                                          MAIN
90014 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0013)                                          MAIN
      GO TO (90015,300), J0013                                          MAIN
90015 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(5) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX4                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      MODE = 0                                                          MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0001)                                     MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(3))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(10,10HFLIGHTPATH,J0004)                               MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HDONOT,J0005)                                      MAIN
      GO TO (90006,90005), J0005                                        MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      GO TO 10                                                          MAIN
90005 CONTINUE                                                          MAIN
      MODE = 1                                                          MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = FLOAT(MODE)                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX5                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      ADD = 0.0                                                         MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HTIME,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(3) = 1.0                                                     MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRANGE,J0004)                                      MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HTOTAL,J0007)                                      MAIN
      GO TO (90008,90007), J0007                                        MAIN
90008 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 90007                                     MAIN
      CALL QXDEN                                                        MAIN
      GO TO 10                                                          MAIN
90007 CONTINUE                                                          MAIN
      TERM(4) = 1.0                                                     MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HNORANGE,J0008)                                    MAIN
      GO TO (90009,300), J0008                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      ADD = 2.0                                                         MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = REVCAL +ADD                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX6                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      TYPE = 0.0                                                        MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0001)                                     MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(3))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HLIFT,J0004)                                       MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 1.0                                                        MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX7                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRANGE,J0001)                                      MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HTOTAL,J0004)                                      MAIN
      GO TO (90005,90004), J0004                                        MAIN
90005 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 90004                                     MAIN
      CALL QXDEN                                                        MAIN
      GO TO 10                                                          MAIN
90004 CONTINUE                                                          MAIN
      TERM(4) = 1.0                                                     MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX8                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      ADD = 0.0                                                         MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HTIME,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
C                                                                       MAIN
C                                                                       MAIN
C                                                                       MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HLIFT,J0004)                                       MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TERM(5) = 1.0                                                     MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HNORANGE,J0005)                                    MAIN
      GO TO (90005,300), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      ADD = 2.0                                                         MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = REVCAL +ADD                                             MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INXX9                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      TYPE = 2.0                                                        MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRANGE,J0001)                                      MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(4) = 1.0                                                     MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(5))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HCONSTANT,J0004)                                   MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(2,2HCL,J0005)                                         MAIN
      GO TO (90005,10), J0005                                           MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TYPE = 3.0                                                        MAIN
      CALL QXSTXT(1,LB,B)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0006)                                       MAIN
      GO TO (90006,10), J0006                                           MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TYPE = 1.0                                                        MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRATE=,J0007)                                      MAIN
      GO TO (90007,300), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0008)                                          MAIN
      GO TO (90008,300), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0009)                                     MAIN
      GO TO (90009,400), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0010)                                          MAIN
      GO TO (90010,400), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0011)                                          MAIN
      GO TO (90011,400), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      GO TO 10                                                          MAIN
  400 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX10                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(8,8HTRANSFER,J0001)                                   MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(12,12HFROMSEGMENT(,J0002)                             MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(11,11H)TOSEGMENT(,J0003)                              MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0004)                                          MAIN
      GO TO (90004,100), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      IF(QXICS.LE.QXFLS)GO TO 100                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL FILBCD(LB, B, Z)                                             MAIN
      CALL BCDINT(Z, LB, INT)                                           MAIN
      TERM(4) = FLOAT(INT)                                              MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(5) = FLOAT(INT)                                              MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0005)                                       MAIN
      GO TO (90005,60), J0005                                           MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(1) = 1.0                                                     MAIN
   60 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0006)                                   MAIN
      GO TO (90006,80), J0006                                           MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(2) = 1.0                                                     MAIN
   80 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0007)                                     MAIN
      GO TO (90007,10), J0007                                           MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(3) = 1.0                                                     MAIN
  100 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX11                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      INTEGER MINMAX(2), VAR(3)                                         MAIN
      DATA MINMAX /7HMINIMUM, 7HMAXIMUM/                                MAIN
      DATA VAR /4HMACH, 8HALTITUDE, 6HWEIGHT/                           MAIN
      TYPE = 0.0                                                        MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0001)                                       MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0004)                                   MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0007)                                     MAIN
      GO TO (90007,300), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0008)                                          MAIN
      GO TO (90008,300), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0009)                                          MAIN
      GO TO (90009,300), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(3))                                       MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HSEGMENT,J0010)                                    MAIN
      GO TO (90010,400), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0011)                                          MAIN
      GO TO (90011,400), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0012)                                          MAIN
      GO TO (90012,400), J0012                                          MAIN
90012 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(5) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  400 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(6,6HCHOOSE,J0013)                                     MAIN
      GO TO (90013,500), J0013                                          MAIN
90013 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HMAX,J0014)                                        MAIN
      GO TO (90014,450), J0014                                          MAIN
90014 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TYPE = 1.0                                                        MAIN
  450 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0015)                                       MAIN
      GO TO (90015,460), J0015                                          MAIN
90015 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(4) = 1.0                                                     MAIN
      GO TO 10                                                          MAIN
  460 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(8,8HALTITUDE,J0016)                                   MAIN
      GO TO (90016,480), J0016                                          MAIN
90016 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(4) = 2.0                                                     MAIN
      GO TO 10                                                          MAIN
  480 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LA,A)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0017)                                     MAIN
      GO TO (90017,10), J0017                                           MAIN
90017 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(4) = 3.0                                                     MAIN
      GO TO 10                                                          MAIN
  500 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX12                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0001)                                     MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(3))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX14                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
      TERM(5) = 1.0                                                     MAIN
      TYPE = 0.0                                                        MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HRESTORE,J0001)                                    MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(4) = FLOAT(INT)                                              MAIN
      TERM(5) = 3.0                                                     MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(5,5HGIVEN,J0004)                                      MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      TERM(5) = 2.0                                                     MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0005)                                       MAIN
      GO TO (90005,120), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0006)                                          MAIN
      GO TO (90006,120), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0007)                                          MAIN
      GO TO (90007,120), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(1))                                       MAIN
  120 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HALT,J0008)                                        MAIN
      GO TO (90008,140), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0009)                                          MAIN
      GO TO (90009,140), J0009                                          MAIN
90009 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0010)                                          MAIN
      GO TO (90010,140), J0010                                          MAIN
90010 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(2))                                       MAIN
  140 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HWEIGHT,J0011)                                     MAIN
      GO TO (90011,150), J0011                                          MAIN
90011 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0012)                                          MAIN
      GO TO (90012,150), J0012                                          MAIN
90012 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0013)                                          MAIN
      GO TO (90013,150), J0013                                          MAIN
90013 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(3))                                       MAIN
  150 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HGLEVEL,J0014)                                     MAIN
      GO TO (90014,160), J0014                                          MAIN
90014 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0015)                                          MAIN
      GO TO (90015,160), J0015                                          MAIN
90015 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0016)                                          MAIN
      GO TO (90016,160), J0016                                          MAIN
90016 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
  160 CONTINUE                                                          MAIN
      GO TO 10                                                          MAIN
C     ........                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIDEN(7,7HCOMPUTE,J0017)                                    MAIN
      GO TO (90017,300), J0017                                          MAIN
90017 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HCRUISE,J0018)                                     MAIN
      GO TO (90018,210), J0018                                          MAIN
90018 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 1.0                                                        MAIN
      GO TO 10                                                          MAIN
  210 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(7,7HCEILING,J0019)                                    MAIN
      GO TO (90019,220), J0019                                          MAIN
90019 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0020)                                          MAIN
      GO TO (90020,220), J0020                                          MAIN
90020 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0021)                                          MAIN
      GO TO (90021,220), J0021                                          MAIN
90021 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
      TYPE = 2.0                                                        MAIN
      GO TO 10                                                          MAIN
  220 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(6,6HENERGY,J0022)                                     MAIN
      GO TO (90022,230), J0022                                          MAIN
90022 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 10.0                                                       MAIN
      GO TO 10                                                          MAIN
  230 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HMACH,J0023)                                       MAIN
      GO TO (90023,10), J0023                                           MAIN
90023 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HLIFT,J0024)                                       MAIN
      GO TO (90024,240), J0024                                          MAIN
90024 CONTINUE                                                          MAIN
      CALL QXIFRC(4,4HDRAG,J0025)                                       MAIN
      GO TO (90025,240), J0025                                          MAIN
90025 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      TYPE = 3.0                                                        MAIN
      GO TO 10                                                          MAIN
  240 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(2,2HCL,J0026)                                         MAIN
      GO TO (90026,250), J0026                                          MAIN
90026 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0027)                                          MAIN
      GO TO (90027,250), J0027                                          MAIN
90027 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0028)                                          MAIN
      GO TO (90028,250), J0028                                          MAIN
90028 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
      TYPE = 4.0                                                        MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HMAX,J0029)                                        MAIN
      GO TO (90029,10), J0029                                           MAIN
90029 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 5.0                                                        MAIN
      GO TO 10                                                          MAIN
  250 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HMAX,J0030)                                        MAIN
      GO TO (90030,10), J0030                                           MAIN
90030 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 6.0                                                        MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(4,4HRATE,J0031)                                       MAIN
      GO TO (90031,260), J0031                                          MAIN
90031 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 7.0                                                        MAIN
      GO TO 10                                                          MAIN
  260 CONTINUE                                                          MAIN
      TYPE = 9.0                                                        MAIN
      TERM(4) = 0.828                                                   MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HMACH(,J0032)                                      MAIN
      GO TO (90032,270), J0032                                          MAIN
90032 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0033)                                          MAIN
      GO TO (90033,270), J0033                                          MAIN
90033 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDDEC(Z, LV, TERM(4))                                       MAIN
  270 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LX,X)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HALT,J0034)                                        MAIN
      GO TO (90034,10), J0034                                           MAIN
90034 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TYPE = 8.0                                                        MAIN
      GO TO 10                                                          MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(7) = TYPE                                                    MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX15                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(1,1H(,J0001)                                          MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H=,J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H,,J0004)                                          MAIN
      GO TO (90004,100), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LC,C,8,1HC)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(1) = FLOAT(INT -1)                                           MAIN
      CALL FILBCD(LC, C, Z)                                             MAIN
      CALL BCDDEC(Z, LC, TERM(5))                                       MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
      SUBROUTINE INX16                                                  MAIN
      DIMENSION A(8),B(8),C(8),V(2),X(8)                                MAIN
      INTEGER QXICS,QXICF                                               MAIN
      COMMON/QXIC/QXICS,QXICF                                           MAIN
      INTEGER QXFLS,QXFS                                                MAIN
      COMMON/QXFILB/QXFLS,QXFS(133)                                     MAIN
      COMMON /INXXA/ LA, A, LB, B, LC, C, LV, V, LX, X, Z(20)           MAIN
      COMMON /INXXB/ REVCAL, NOEND, TERM(10)                            MAIN
      LOGICAL NOEND                                                     MAIN
   10 CONTINUE                                                          MAIN
      CALL FILL80                                                       MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HONE,J0001)                                        MAIN
      GO TO (90001,100), J0001                                          MAIN
90001 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0002)                                          MAIN
      GO TO (90002,100), J0002                                          MAIN
90002 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0003)                                          MAIN
      GO TO (90003,100), J0003                                          MAIN
90003 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(4) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  100 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(3,3HTWO,J0004)                                        MAIN
      GO TO (90004,200), J0004                                          MAIN
90004 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H(,J0005)                                          MAIN
      GO TO (90005,200), J0005                                          MAIN
90005 CONTINUE                                                          MAIN
      CALL QXIFRC(1,1H),J0006)                                          MAIN
      GO TO (90006,200), J0006                                          MAIN
90006 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      CALL QXIGET(LV,V,2,1HV)                                           MAIN
      CALL QXIGET(LX,X,8,1HX)                                           MAIN
      CALL FILBCD(LV, V, Z)                                             MAIN
      CALL BCDINT(Z, LV, INT)                                           MAIN
      TERM(5) = FLOAT(INT)                                              MAIN
      GO TO 10                                                          MAIN
  200 CONTINUE                                                          MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(5,5HRANGE,J0007)                                      MAIN
      GO TO (90007,300), J0007                                          MAIN
90007 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TERM(3) = 1.0                                                     MAIN
      CALL QXSTXT(1,LC,C)                                               MAIN
      CALL QXICOL(1,0,1)                                                MAIN
      CALL QXIFRC(2,2HNO,J0008)                                         MAIN
      GO TO (90008,300), J0008                                          MAIN
90008 CONTINUE                                                          MAIN
      CALL QXIREC                                                       MAIN
      CALL QXDEN                                                        MAIN
      CALL QXIGET(LA,A,8,1HA)                                           MAIN
      CALL QXIGET(LB,B,8,1HB)                                           MAIN
      TERM(3) = -1.0                                                    MAIN
  300 CONTINUE                                                          MAIN
      CALL ALLUSE                                                       MAIN
      IF(NOEND)  GO TO 10                                               MAIN
      TERM(3) = TERM(3) +1.0                                            MAIN
      RETURN                                                            MAIN
      END                                                               MAIN
